A lot of people that are new to programming the Arduino ADK board and trying to get it to work with Android. If you are having problems one of our customers (Eddie Bryant) has shared his experience with the process, and we hope that perhaps this short guide will help with your projects.
I struggled for days trying to get sketches to compile with the newest version of Arduino IDE 1.0.5. I was getting an EP_Record does not have a type error. There were a lot of people having this problem, and none of the suggestions helped me. I read something about an USBHost library that accommodated USB 2.0. I struggled and struggle to find the answer, finally digging into the code of the header .h files. What I found was the AndroidAccessory.h was calling an Usb.h file and in the USBHost2.0 library that file did not define the EP_Record, but in the older library it did. I dropped back to the older library, but picked up another error dealing with the MaxLCD.
There happened to be a third USBHost library out on the web, by Oleg Mazurov http://www.circuitsathome.com/mcu/usb-host-shield-library-version-2-0-released and replacing the MaxLCD.h from that one fixed the issue and the sketch was able to compile successfully.
1.) Replace MaxLCD.h from built in library with the one in Oleg Mazurov’s version: http://www.circuitsathome.com/mcu/usb-host-shield-library-version-2-0-released
Ok, that problem fixed now it was time to learn Android programming. I struggled with Eclipse trying to get it configured properly and then gave up switching to Android Studio.
I found most of the problems associate with getting the programs to work involved not having the proper imports. Some of the examples in the books are very sketchy (no pun intended). I mean they tend to leave out that you need this or that import to clear up errors, so dig in and research to try and find out if you are missing an import.
You can have a program that builds successfully and will make the apk without a problem, but will not run on your Android device unless you have generated a signed apk. You have to have a keystore before the program will open on your Android device. I finally cleaned up all the errors on my Hello Android/Arduino ADK program from the book “Beginning Android ADK with Arduino”.
2.)Don’t forget to generate a signed APK for your android apps.
But, still had three errors I could not get rid of. One with getInstance and two with getAccessory. Another couple day’s research lead me to this webpage.
http://developer.android.com/guide/topics/connectivity/usb/accessory.html If you scroll down to the section: Usage differences between the add-on library and platform APIs, you will see the answer. Apparently the author was using a different library and when I replaced the code with (UsbManager) getSystemService and (UsbAccessory) intent.getParcelableExtra, I was able to build successfully.
I am still working on getting the Arduino ADK and the Android Nexus 7 to talk with each other, but at this point I am able to get Arduino sketches and Android code to compile. I hope this will help those like me that are struggling to learn how to use Android to talk with Arduino.
3.) Follow this guide for help getting your build working: http://developer.android.com/guide/topics/connectivity/usb/accessory.html
Special thanks to Eddie Bryant for sharing his experience with the Arduino ADK, I hope that this helps some folks get started with the device a little easier.