Sketch won't compile if imports not in a distinct class?! [SOLVED]
in
Android Processing
•
1 year ago
I've been having problems compiling existing sketches for Android (e.g. Ketai library examples and the code provided in this post:
http://webdelcire.com/wordpress/archives/1045). There don't seem to be many people having problems compiling with either which tells me there is something up with my setup. The error I get is:
"Error from inside the Android tools, check the console."
...and...
BUILD FAILED
/Users/zimady/Tools/android-sdk-macosx/tools/ant/build.xml:850: The following error occurred while executing this line:
/Users/zimady/Tools/android-sdk-macosx/tools/ant/build.xml:852: The following error occurred while executing this line:
/Users/zimady/Tools/android-sdk-macosx/tools/ant/build.xml:864: The following error occurred while executing this line:
/Users/zimady/Tools/android-sdk-macosx/tools/ant/build.xml:266: null returned: 1
After spending quite some time trying to isolate the error, I eventually discovered that it is caused simply by trying to import the required classes. For example, this will fail:
- import android.bluetooth.BluetoothAdapter;
- /*... plus other classes from post mentioned above ...*/
- void setup() {}
- void draw() {}
I then tested one of the included Android examples (specifically, Accelerometer) and it compiled without issue. I checked for differences in the manifests but nothing. I then decided to try and duplicate the structure of the Accelerometer sketch, resulting in this in the main sketch .pde:
- BlahClass blah;
- void setup() {
- blah = new BlahClass();
- }
- void draw() {}
- import android.bluetooth.BluetoothAdapter;
- /*... plus other classes from post mentioned above ...*/
- public class BlahClass {
- public BlahClass() {}
- }
It compiles successfully!
So, to summarise, I can compile with class imports placed in a distinct class file but not when the imports are just at the top the main .pde for the sketch. Why?
(Processing 2.0a8)
EDIT: I discovered through trial and error that there were some conflicts with stuff in my libraries folder. Removing them has made my world whole again.
1