I'm having some weird colour issues in an Android project I'm working on. Everything works fine in Standard mode but misbehaves in Android mode. Whilst trying to debug the issue, I realised that HSB colorMode behaves differently in Android mode than Standard mode.
I've condensed the issue into a small sketch. The comments describe exactly the problem and how to duplicate it. If anyone can offer an explanation for the color inconsistencies between Android and Standard modes, it may help me to identify the issue in my sketch.
Thanks.
[EDIT] I discovered another clue. The colour change seen in case 4 in the sketch is *always* the same. i.e. it doesn't seem to matter what rgbColor is set to, it will be rendered pink if the HSB conversion is done.
/*
* Inconsistent HSB behaviour in STANDARD & ANDROID modes?
* To replicate:
*
* Compile in STANDARD mode
* 1) set useRGB = true. Compile. Note colours (screen grab if necessary)
* 2) set useRGB = false. Compile. Note colours are the same (compare screen grab if necessary)
*
* Compile in ANDROID mode
* 3) set useRGB = true. Compile. Note colours (screen grab if necessary)
* 4) set useRGB = false. Compile. Note colours are DIFFERENT!! (compare screenshot if necessary)
*/
color backgroundColor = #231000;
color rgbColor = #66ffff;
color fillColor;
boolean useRGB = false;
void setup() {
//size( 500, 500 ); // use for STANDARD compiler
noStroke();
}
void draw() {
background( backgroundColor );
rectMode(CENTER);
translate( width/2, height/2 );
if( useRGB ) {
fillColor = rgbColor;
} else {
// all we do when useRGB == false is change colorMode to HSB, grab HSB components,
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:
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() {}
...and BlahClass.java (note: it has to be .java)...
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.