I'm doing a mobile app which will be based on HTML5, javascript and CSS, so it can be develop both in iOS and and Android at the same time.

So the projet structure is this

├─ android (the android project)

├─ angular (the main project)

├─ ios (the ios project)

I've set up the Gruntfile.js to compile everything and generate a "www" folder inside the "angular" folder. I've already set up the cordova as well.

The problem is: if I manually copy the generated "www" folder to the android//assets folder, everything works fine.

But there's no way to set the android config to look outside it's project and use another directory as it's assets source dir?

I already tried everything that's here:

http://cordova.apache.org/docs/en/3.3.0/config_ref_index.md.html and here:

http://www.mentalfaps.com/blog/2013/08/29/using-yeoman-with-phonegap-and-backbone-dot-js/ (even if this is not with angular, the config should be the same)

Can anybody help me with this?

有帮助吗?

解决方案 2

So I've managed to do this with symbolic links. I tried (as I said) to do it like here: http://www.mentalfaps.com/blog/2013/08/29/using-yeoman-with-phonegap-and-backbone-dot-js/ But then I noticed that the link was made in the wrong way: So, what I did: (in the Android's project assets dir)

rm -rf www
ln -s <path to angular www folder> www

Now this will create the right link. reopen your eclipse. Refresh the project and you should see a copy of www in the assets folder!

Hope it helps anyone who was having the same problem.

其他提示

There's no one correct structure but what works for me is to build the project first with the Cordova command line util, then develop your code in the top level project 'www' directory and / or get Grunt to output to whatever structure you want within that.

Crucially, let Cordova manage everything within the platforms directory (/ios and /android).

You can then update the platform targets using:

cordova prepare ios or cordova prepare android

So long as you use prepare and not build cordova won't overwrite the entire project, it'll just sync your code changes in www.

So for example your XCode project settings should be untouched.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top