We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have been getting this error all day when I try and use the UsbAccessory system to control a Arduino. Every forum post I find does not have the answers I need or they dont work. Does anyone know what could be wrong. I am using API:10 for android and Processing 2.1.1 Here is my Code:
import cc.arduino.*;
import oscP5.*;
import netP5.*;
import android.os.ParcelFileDescriptor;
import android.content.Intent;
ArduinoAdkUsb arduino;
OscP5 oscP5;
void setup(){
size(1024,720);
oscP5 = new OscP5(this,9000);
arduino = new ArduinoAdkUsb(this);
if (arduino.list() != null) arduino.connect(arduino.list()[0]);
orientation(LANDSCAPE);
noStroke();
background(255,255,255);
fill(255,0,0);
rect(50,50,100,75);
fill(255,0,0);
rect(200,50,100,75);
}
void draw(){
if(arduino.isConnected()){
fill(0,255,0);
rect(50,50,100,75);
}
}
void oscEvent(OscMessage theOscMessage){
String addr = theOscMessage.addrPattern();
float val = theOscMessage.get(0).floatValue();
}
Here is the Error:
-set-mode-check:
-set-debug-files:
-check-env:
Android SDK Tools Revision 22.3.0
Installed at R:\adt-bundle-windows-x86_64-20131030\sdk
-setup:
[echo] Project Name: Android_Host
Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
Using latest Build Tools: 18.1.1
[echo] Resolving Build Target for Android_Host...
Project Target: Android 2.3.3
API level: 10
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: R:\Users\TGBBA_~1\AppData\Local\Temp\android1986097186668647733sketch\bin
[mkdir] Created dir: R:\Users\TGBBA_~1\AppData\Local\Temp\android1986097186668647733sketch\bin\res
[mkdir] Created dir: R:\Users\TGBBA_~1\AppData\Local\Temp\android1986097186668647733sketch\bin\rsObj
[mkdir] Created dir: R:\Users\TGBBA_~1\AppData\Local\Temp\android1986097186668647733sketch\bin\rsLibs
[mkdir] Created dir: R:\Users\TGBBA_~1\AppData\Local\Temp\android1986097186668647733sketch\gen
[mkdir] Created dir: R:\Users\TGBBA_~1\AppData\Local\Temp\android1986097186668647733sketch\bin\classes
[mkdir] Created dir: R:\Users\TGBBA_~1\AppData\Local\Temp\android1986097186668647733sketch\bin\dexedLibs
[echo] ----------
[echo] Resolving Dependencies for Android_Host...
Library dependencies:
No Libraries
------------------
API<=15: Adding annotations.jar to the classpath.
[echo] ----------
[echo] Building Libraries with 'debug'...
[subant] No sub-builds to iterate on
-code-gen:
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
Generating BuildConfig class.
-pre-compile:
-compile:
[javac] Compiling 3 source files to R:\Users\TGBBA_~1\AppData\Local\Temp\android1986097186668647733sketch\bin\classes
[javac] R:\Users\TGBBA_~1\AppData\Local\Temp\android1986097186668647733sketch\src\processing\test\android_host\Android_Host.java:38: error: cannot access UsbAccessory
[javac] if (arduino.list() != null) arduino.connect(arduino.list()[0]);
[javac] if (arduino.list() != null) arduino.connect(arduino.list()[0]);
[javac] ^
[javac] class file for com.android.future.usb.UsbAccessory not found
[javac] 1 error
BUILD FAILED
R:\adt-bundle-windows-x86_64-20131030\sdk\tools\ant\build.xml:720: The following error occurred while executing this line:
R:\adt-bundle-windows-x86_64-20131030\sdk\tools\ant\build.xml:734: Compile failed; see the compiler error output for details.
Total time: 3 seconds
The Code is pretty empty as I was just trying to get it to compile. I need help soon as I cannot go any farther with my project until I solve this
Thanks
Answers
According to this StackOverflow post, you need to add the Google APIs to your sketch if you are targeting an API level lower than 12 (Processing forces you to use 10). I don't have any experience with this particular area of Android... but this resource may be helpful (make sure to add what it says to the manifest file).