Whenever you ask or search for help regarding Android development, you end up with some fix related to the Eclipse ADT plugin or the Android SDK tools. My intention is to fix that by repeating parts of a great tip I found at Tim Perry’s blog. It is about how to get hold of the resources placed under the /assets folder in you Android project while running your applictaion in the Emulator from NetBeans. If your application tries to access resources from the AssetManager you will get a FileNotFoundException. The reason for this is that the assets are not packaged with the .apk like it is if you package and deploy it using the SDK tools.
The solution is:
- Go into nbproject/project.properties and add ‘assets.available=true‘
Voila! You will now be able to run, debug and step through your code as you would expect.
May 11th, 2010 at 5:01 pm
[...] Android Emulator and NetBeans May [...]
February 7th, 2011 at 10:04 am
Hi,
Thanks for your posts regarding using netbeans and android, they are so useful.
I have some question, I hope you know solution.
I know that using nbandroid plugin it isn’t possible to create project from existed code, so the suggested solution is to use a free-form java project. I have created such a project, it builds, runs successfully, but the only issue is how to debug such an application?
Regards,
Daniil
February 7th, 2011 at 11:51 am
It has been a while since I did any Android development, but this works for me:
1. Create a new Android project
2. Symlink AndroidManifest.xml, and the src, res, test folders
3. Add target “post-jar” to the build.xml file as described here: http://www.agilejava.eu/2010/05/11/netbeans-and-android-tip/ (you don’t need the pre-jar unless you use external libs..)
4. Start emulator
5. Build project
6. Right-click project in Netbeans, choose debug and select the running emulator instance
Good luck!