Build failed with Processing (2.0b7) and how it is solved
in
Android Processing
•
8 months ago
Hi all,
I've written a little app and have been successfully running in my Android devices via the native IDE for a few months. But earlier this year when I updated Processing (or the Java sdk) it stops compiling.
I eventually figured out why (kind of) and made it work, and thought it might be useful for you guys. The build error messages I got were something like:
1. uses unchecked or unsafe operations ... recompile with "-Xlint:unchecked" for details"
2. trouble processing "java/security/Provider.class": ... Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library
Turns out it was a two-step problem.
For 1), make sure all the ArrayList objects you created in the file has a type, so "ArrayList myList = new ArrayList();" does not work anymore, and should instead look like "ArrayList<PVector> myList = new ArrayList<PVector>();. If the problem persists or you really want to use the -Xlint:unchecked option, there is a way:
Have Ant installed and properly set up. Go to your Android sdk->ant folder (e.g. C:\Program Files\Android\android-sdk\tools\ant\) and copy of the "build.xml" file, paste it to the exported application folder of your project with the name as "custom-rules.xml". Inside, look for the property with the name "java.compilerargs" and set the value to "-Xlint:unchecked". Then in the "build.xml" file comment out the {$sdk.dir}/tools/ant/build.xml import tag so only the file you just copied and modified will be used.
This is a rather tedious way and you have to do the same thing everytime you export a new folder. But it seems that the Processing IDE doesn't have that option.
For 2), turns out the Processing version I have automatically added the "android.jar" library when exporting the project (it's in the "libs" folder). All you need to do is to remove it.
But the catch is I couldn't find a simple way to install my the application into my device -- once I click that "play" button everything is done automatically again and there is no way I can skip the inclusion of this jar file, which causes the conflict. So I had to resort to the command-line approach:
Open a command prompt and navigate to the Android sdk platform-tools directory for the "adb" tool, or set your system path to include that. Then use the command:
adb -d install <your_app>-debug.apk
For more details check out the Android website: http://developer.android.com/tools/building/building-cmdline.html
Note that next time you install the same app you'll have to uninstall it from the device manually first.
I'm not sure if I've missed some settings from the IDE and caught myself in those steps, but those are the steps I took and it worked. I guess the developers can at least look into the automatic inclusion of the "android.jar" library which seems to be the cause of the build failure.
Best,
Victor
I've written a little app and have been successfully running in my Android devices via the native IDE for a few months. But earlier this year when I updated Processing (or the Java sdk) it stops compiling.
I eventually figured out why (kind of) and made it work, and thought it might be useful for you guys. The build error messages I got were something like:
1. uses unchecked or unsafe operations ... recompile with "-Xlint:unchecked" for details"
2. trouble processing "java/security/Provider.class": ... Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library
Turns out it was a two-step problem.
For 1), make sure all the ArrayList objects you created in the file has a type, so "ArrayList myList = new ArrayList();" does not work anymore, and should instead look like "ArrayList<PVector> myList = new ArrayList<PVector>();. If the problem persists or you really want to use the -Xlint:unchecked option, there is a way:
Have Ant installed and properly set up. Go to your Android sdk->ant folder (e.g. C:\Program Files\Android\android-sdk\tools\ant\) and copy of the "build.xml" file, paste it to the exported application folder of your project with the name as "custom-rules.xml". Inside, look for the property with the name "java.compilerargs" and set the value to "-Xlint:unchecked". Then in the "build.xml" file comment out the {$sdk.dir}/tools/ant/build.xml import tag so only the file you just copied and modified will be used.
This is a rather tedious way and you have to do the same thing everytime you export a new folder. But it seems that the Processing IDE doesn't have that option.
For 2), turns out the Processing version I have automatically added the "android.jar" library when exporting the project (it's in the "libs" folder). All you need to do is to remove it.
But the catch is I couldn't find a simple way to install my the application into my device -- once I click that "play" button everything is done automatically again and there is no way I can skip the inclusion of this jar file, which causes the conflict. So I had to resort to the command-line approach:
Open a command prompt and navigate to the Android sdk platform-tools directory for the "adb" tool, or set your system path to include that. Then use the command:
adb -d install <your_app>-debug.apk
For more details check out the Android website: http://developer.android.com/tools/building/building-cmdline.html
Note that next time you install the same app you'll have to uninstall it from the device manually first.
I'm not sure if I've missed some settings from the IDE and caught myself in those steps, but those are the steps I took and it worked. I guess the developers can at least look into the automatic inclusion of the "android.jar" library which seems to be the cause of the build failure.
Best,
Victor