I have a project that uses 3 other projects as libraries and has quite a lot of images. The app runs fine on the device in the debugging mode, but when I try to build and sign an apk to publish the app, I get the following error:
Command-line Error 139
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeAapt(BuildHelper.java:708)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.packageResources(BuildHelper.java:184)
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:131)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.doExport(ExportWizard.java:290)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.access$0(ExportWizard.java:229)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard$1.run(ExportWizard.java:214)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Can someone please tell me what it means?
I have been doing a lot of trial and error to remove it but at best managed to make the apk one or two times, that to I am not sure of in terms of bugs... Its my 3rd day with this problem any help would be really appreciated.My R.java file is also not getting created by itself (using eclipse under Ubuntu 10.1 and android api level 7)...
And also the resources.ap_ file needs to be added manually...
UPDATE:
I tried using command line instead of eclipse.
the error comes when ant reaches the rfolder="${gen.absolute.dir}" line in the ant build_rules.xml file... which is the part when aapt tool of the android SDK builds the apk (and all the other resource files in the bin) so the ant build fails whi开发者_如何转开发le packaging the resources.. This happens even when there is R.java file (generated after manually adding it and deleting it so that eclipse regenerates it)...
The apk sometimes builds when i 1. manually add an empty resources.ap_ file in the bin 2. build 3. deleting the .apk and resources.ap_ files after the build and 4. again build..
Even in this case i am able to export the signed apk file only 1 in 10 times i try..
Another very un-natural behaviour has been that at times if I leave the code alone for 15-20 mins, all the errors are gone.. (maybe sumthing to do with memory)
OK. So after 2 weeks of no sleep, I have found the problem. The problem was in a file named "ids.xml" in my values folder, which was being used to create Static constant integer ids which could be used anywhere in the code using R.id.xyz the file had resources in the form of
<item type="id" name="xyz"/>
I removed this file and created Static final integers (old style java way) inside one of the classes, and used them by class name and dot operator.
The code complies, builds and signs (export apk) fine. The conflict it seems was that the R.java file was not getting auto created because of this ids.xml file and this was causing problems in the normal build process by interrupting the creation of resources.ap_ file. Now if I was forcefully creating R.java and resources.ap_ their version or probably the order of packaging in a signed apk was getting disturbed (this kind of explains why I was able to make a signed apk 1-2 times in 10-20 trials and errors).
精彩评论