Control P5 crash on device (build ok)
in
Android Processing
•
1 year ago
Hi All,
I'm just starting to take a look at using processing & controlP5 to write an
arduino BT app. on android.
While processing sketches build & run correctly on my target device (jelly-bean 4.1, nexus 7), neither of the
controllP5 examples work.
Building from within the Processing IDE completes without problem, but as soon as the app launches on the device (and I have tried a second device as well, no success), it crashes with the following output ...
Android SDK Tools Revision 20.0.3
Installed at D:Umaesschpandroid-sdks
Project Type: Application
Project Target: Android 2.3.3
API level: 10
Library dependencies:
No Libraries
------------------
API<=15: Adding annotations.jar to the classpath.
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
No AIDL files to compile.
No RenderScript files to compile.
Generating resource IDs...
Generating BuildConfig class.
Converting compiled files and external libraries into d:UmaesschpAppDataLocalTempandroid4218929151269187915sketchinclasses.dex...
Creating full resource package...
Current build type is different than previous build: forced apkbuilder run.
Creating ControlP5checkBox-debug-unaligned.apk and signing it with a debug key...
Running zip align on final apk...
FATAL EXCEPTION: Animation Thread
java.lang.NoSuchMethodError: processing.core.PApplet.registerMethod
at controlP5.ControlWindow.init(Unknown Source)
at controlP5.ControlWindow.<init>(Unknown Source)
at controlP5.ControlP5.init(Unknown Source)
at controlP5.ControlP5.<init>(Unknown Source)
at processing.test.controlp5checkbox.ControlP5checkBox.setup(ControlP5checkBox.java:44)
at processing.core.PApplet.handleDraw(PApplet.java:1855)
at processing.core.PGraphicsAndroid2D.requestDraw(PGraphicsAndroid2D.java:161)
at processing.core.PApplet.run(PApplet.java:1746)
at java.lang.Thread.run(Thread.java:856)
Processing version = 2.0b3, controllP5 = 2.0.1, SDK-tools = 20.0.3 and installed API levels are
16 & 10.
10 seems to be selected & required ... not sure if this is the reason, but if so, then I don't know how to force
processing to use 16 i.s.o. 10.
Thanks for your help on this guys, if more info or logs are required just ask ...
Best regards
Patrick.
p.s. none of the examples work, but just to make the post complete, this is the sketch I tried last ..
/**
* ControlP5 Checkbox
* an example demonstrating the use of a checkbox in controlP5.
* CheckBox extends the RadioButton class.
* to control a checkbox use:
* activate(), deactivate(), activateAll(), deactivateAll(), toggle(), getState()
*
* find a list of public methods available for the Checkbox Controller
* at the bottom of this sketch's source code
*
* by Andreas Schlegel, 2012
* www.sojamo.de/libraries/controlP5
*
*/
import controlP5.*;
ControlP5 cp5;
CheckBox checkbox;
int myColorBackground;
void setup() {
size(700, 400);
smooth();
cp5 = new ControlP5(this);
checkbox = cp5.addCheckBox("checkBox")
.setPosition(100, 200)
.setColorForeground(color(120))
.setColorActive(color(255))
.setColorLabel(color(255))
.setSize(40, 40)
.setItemsPerRow(3)
.setSpacingColumn(30)
.setSpacingRow(20)
.addItem("0", 0)
.addItem("50", 50)
.addItem("100", 100)
.addItem("150", 150)
.addItem("200", 200)
.addItem("255", 255)
;
}
void keyPressed() {
if (key==' ') {
checkbox.deactivateAll();
}
else {
for (int i=0;i<6;i++) {
// check if key 0-5 have been pressed and toggle
// the checkbox item accordingly.
if (keyCode==(48 + i)) {
// the index of checkbox items start at 0
checkbox.toggle(i);
println("toggle "+checkbox.getItem(i).name());
// also see
// checkbox.activate(index);
// checkbox.deactivate(index);
}
}
}
}
void draw() {
background(0);
pushMatrix();
translate(width/2 + 200, height/2);
stroke(255);
strokeWeight(2);
fill(myColorBackground);
ellipse(0,0,200,200);
popMatrix();
}
void controlEvent(ControlEvent theEvent) {
if (theEvent.isFrom(checkbox)) {
myColorBackground = 0;
print("got an event from "+checkbox.getName()+" ");
// checkbox uses arrayValue to store the state of
// individual checkbox-items. usage:
println(checkbox.getArrayValue());
int col = 0;
for (int i=0;i<checkbox.getArrayValue().length;i++) {
int n = (int)checkbox.getArrayValue()[i];
print(n);
if(n==1) {
myColorBackground += checkbox.getItem(i).internalValue();
}
}
println();
}
}
void checkBox(float[] a) {
println(a);
}
I'm just starting to take a look at using processing & controlP5 to write an
arduino BT app. on android.
While processing sketches build & run correctly on my target device (jelly-bean 4.1, nexus 7), neither of the
controllP5 examples work.
Building from within the Processing IDE completes without problem, but as soon as the app launches on the device (and I have tried a second device as well, no success), it crashes with the following output ...
Android SDK Tools Revision 20.0.3
Installed at D:Umaesschpandroid-sdks
Project Type: Application
Project Target: Android 2.3.3
API level: 10
Library dependencies:
No Libraries
------------------
API<=15: Adding annotations.jar to the classpath.
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
No AIDL files to compile.
No RenderScript files to compile.
Generating resource IDs...
Generating BuildConfig class.
Converting compiled files and external libraries into d:UmaesschpAppDataLocalTempandroid4218929151269187915sketchinclasses.dex...
Creating full resource package...
Current build type is different than previous build: forced apkbuilder run.
Creating ControlP5checkBox-debug-unaligned.apk and signing it with a debug key...
Running zip align on final apk...
FATAL EXCEPTION: Animation Thread
java.lang.NoSuchMethodError: processing.core.PApplet.registerMethod
at controlP5.ControlWindow.init(Unknown Source)
at controlP5.ControlWindow.<init>(Unknown Source)
at controlP5.ControlP5.init(Unknown Source)
at controlP5.ControlP5.<init>(Unknown Source)
at processing.test.controlp5checkbox.ControlP5checkBox.setup(ControlP5checkBox.java:44)
at processing.core.PApplet.handleDraw(PApplet.java:1855)
at processing.core.PGraphicsAndroid2D.requestDraw(PGraphicsAndroid2D.java:161)
at processing.core.PApplet.run(PApplet.java:1746)
at java.lang.Thread.run(Thread.java:856)
Processing version = 2.0b3, controllP5 = 2.0.1, SDK-tools = 20.0.3 and installed API levels are
16 & 10.
10 seems to be selected & required ... not sure if this is the reason, but if so, then I don't know how to force
processing to use 16 i.s.o. 10.
Thanks for your help on this guys, if more info or logs are required just ask ...
Best regards
Patrick.
p.s. none of the examples work, but just to make the post complete, this is the sketch I tried last ..
/**
* ControlP5 Checkbox
* an example demonstrating the use of a checkbox in controlP5.
* CheckBox extends the RadioButton class.
* to control a checkbox use:
* activate(), deactivate(), activateAll(), deactivateAll(), toggle(), getState()
*
* find a list of public methods available for the Checkbox Controller
* at the bottom of this sketch's source code
*
* by Andreas Schlegel, 2012
* www.sojamo.de/libraries/controlP5
*
*/
import controlP5.*;
ControlP5 cp5;
CheckBox checkbox;
int myColorBackground;
void setup() {
size(700, 400);
smooth();
cp5 = new ControlP5(this);
checkbox = cp5.addCheckBox("checkBox")
.setPosition(100, 200)
.setColorForeground(color(120))
.setColorActive(color(255))
.setColorLabel(color(255))
.setSize(40, 40)
.setItemsPerRow(3)
.setSpacingColumn(30)
.setSpacingRow(20)
.addItem("0", 0)
.addItem("50", 50)
.addItem("100", 100)
.addItem("150", 150)
.addItem("200", 200)
.addItem("255", 255)
;
}
void keyPressed() {
if (key==' ') {
checkbox.deactivateAll();
}
else {
for (int i=0;i<6;i++) {
// check if key 0-5 have been pressed and toggle
// the checkbox item accordingly.
if (keyCode==(48 + i)) {
// the index of checkbox items start at 0
checkbox.toggle(i);
println("toggle "+checkbox.getItem(i).name());
// also see
// checkbox.activate(index);
// checkbox.deactivate(index);
}
}
}
}
void draw() {
background(0);
pushMatrix();
translate(width/2 + 200, height/2);
stroke(255);
strokeWeight(2);
fill(myColorBackground);
ellipse(0,0,200,200);
popMatrix();
}
void controlEvent(ControlEvent theEvent) {
if (theEvent.isFrom(checkbox)) {
myColorBackground = 0;
print("got an event from "+checkbox.getName()+" ");
// checkbox uses arrayValue to store the state of
// individual checkbox-items. usage:
println(checkbox.getArrayValue());
int col = 0;
for (int i=0;i<checkbox.getArrayValue().length;i++) {
int n = (int)checkbox.getArrayValue()[i];
print(n);
if(n==1) {
myColorBackground += checkbox.getItem(i).internalValue();
}
}
println();
}
}
void checkBox(float[] a) {
println(a);
}
1