I have seen numerous posts regarding problems with getting Android set up and running for the first time (with at least two in the past twenty-four hours) and, as I appear to be on "help everyone with Android problems" duty, I have decided to create this post, which anyone experiencing problems setting up and / or running Android sketches should check
before they ask their own question.
Before you look here, you should, of course, read
the Wiki because a lot of your questions should be answered there.
Let's divide the possible problems into three categories: Build Errors, Emulator Errors, and Device Errors.
Build Errors
You have installed the Android SDK and are just starting out your first sketch when, all of a sudden, you get that big, nasty "
BUILD_FAILED " message. This is where you should look for common problems.
First, there are a couple of things to check to make sure that you are doing:
You must use the latest version of Processing (to get the latest version of Processing, go to the Download Page and select the most recent version.
You must have everything that is required for Android Processing: Processing itself (see above), the JDK, and the Android SDK. You must have installed all of these correctly. The Android SDK is most likely to be installed incorrectly, and this is the main source of all of the build issues.
Before you complain about Android Processing not working, you have to make sure that the code that you are testing with is valid. If you are unsure, try testing one of the Examples.
If, after that (relatively) short list of possible problems, you are still having issues (which you probably will), then please consult this next list of possible problems:
Make sure that Processing knows where to look for the Android SDK . The easiest way to test this is (from the PDE) to go to Android > Android SDK Manager . If the SDK Manager starts up, then your path is probably set up right. If not, then follow these steps below:
Locate the Android SDK with a file browser. Remember the path.
Open File > Preferences .
Click on the link to the "preferences.txt" file at the bottom.
Open "preferences.txt" (if it has not already done so) with a plain text editor.
Modify the property "android.sdk.path" to be the location that you found earlier. If it does not exist, then create it. An example: "android.sdk.path=C:Program Files (x86)Androidandroid-sdk" (without quotes, and the example is from Windows using Windows slashes).
If you're on Windows, then you might need to mess with the System PATH variables. You can edit the PATH variables by right-clicking on Computer > Properties > Change Properties > Advanced > Environment Variables . WARNING : Messing with these variables can seriously mess up your computer if not done properly. You should check the following:
Variable JAVA_HOME should point to the location of the bin folder within the JDK.
Variable ANDROID_HOME should point to the location of the bin folder within the Android folder.
Variable ANT_HOME should point to the location of the ant folder within the android tools folder.
Variable ADB_HOME should point to the location of the location of the android/android-sdk/platform-tools folder.
All of these variables should be referenced from within the PATH variable. You can reference a variable by specifying its name surrounded by percent signs ( % ). In order for the variable to be properly unwrapped, it must be enclosed in percent signs and each individual variable must be separated by a semicolon. For example: "%JAVA_HOME%;%ANT_HOME%;ADB_HOME%;%ANDROID_HOME%"
Note: Not all of these variables are, technically, necessary. It is possible to build without all of them.
Are the right packages installed from the SDK Manager? (If you can't open the SDK Manager, then that's a problem of its own and you need to reinstall it, see above.) You should have the latest version of the tools and the latest version of the SDK. At writing time, these are 20.0.3 (for the tools) and Android 4.1 (or API level 16). If there are uninstalled packages, then you should probably install them. If you cannot see these packages, then this is a problem of its own. You might have to reinstall the SDK Tools or check to make sure that you are connected to the internet properly.
Note: On Windows, you may need to make sure you run the SDK Manager "as an administrator", or else it won't be able install the packages in certain locations on your computer.
Emulator Errors
If you have successfully built your project (you
don't get
BUILD_FAILED ) but you cannot start the emulator (errors such as
NOT_BOOTED or
NOT_RUNNING ), then you've come to the right place.
If all of the errors mentioned above are resolved, then check the following:
Open the AVD Manager and check to see if a Processing emulator exists. If it does not, then Processing could not successfully create an emulator. You can try creating one (such as "Processing-0206") by doing the following:
Click the New button.
Enter a name and select a target (must be at least API level 9).
Everything else you can leave blank. Click Create AVD.
Now, try starting your new emulator. Select it and click Start. If the emulator starts up properly, then the problem is with Processing. If not, then there is something wrong with the way that the SDK is set up. Make sure that all of the packages are installed in the SDK Manager.
Lastly, there are a couple of pieces of information that are useful to us, people that are trying to help you, answer your question quickly, if your problem is not resolved my reading the above:
Your operating system
What version of the Android SDK you're using
NOTE: This post is
not completed, but I'm only one person. I'll try to get it finished in my free time over the next couple of days. If you have suggestions / comments, let me know through a reply. If any of my fixes help you, that is useful to know, too.
For a long time, I've been able to create full-screen applications with the typical
frame.setUndecorated(true) call and then relocating the frame to the top left corner of the screen with
frame.setLocation(0, 0). However, I've always had to relocate the frame in the first frame of draw, otherwise it would fail to work.
I'm running Windows 7 64 bit with both Processing 1.5.1 and 2.0a7.
From the thread above, the following code is supposed to work, although it doesn't:
public void init() {
frame.removeNotify();
frame.setUndecorated(true);
frame.addNotify();
super.init();
}
void setup() {
size(displayWidth, displayHeight);
frame.setLocation(0, 0); //This does not work
}
void draw() {
println(millis());
}
I always end up using something like this:
void setup() {
size(displayWidth, displayHeight);
frame.setLocation(0, 0); //This doesn't work
}
public void init() {
frame.removeNotify();
frame.setUndecorated(true);
frame.addNotify();
super.init();
}
void draw() {
if(frameCount == 1) frame.setLocation(0, 0); //This does
println(millis());
}
Note that both of these pieces of code are written for Processing 2.0a7; for Processing 1.5.1 users, you will have to change displayWidth and displayHeight to screenWidth and screenHeight, respectfully.
At any rate, I am able to produce full screen applications. I'm just wondering why I am encountering this problem, if anyone else is in the same boat, and if there is a reason why and / or a solution.
NOTE: Sorry for the non-descriptive title, but I lack much information other than that about the problem...
I'm just getting started with Processing.js, and I'm trying to create some test programs.
The one below tests the randomness of the random function... which works fine in Standard mode, but won't start in JavaScript mode.
I'm curious as to which part of the code is causing this... or am I doing something wrong altogether?
I've gotten other programs working, so it isn't a problem with my setup...
The code:
ArrayList<Integer> list;
void setup() {
size(600, 400);
list = new ArrayList<Integer>();
fill(0);
noStroke();
}
void draw() {
background(255);
list.add(new Integer((int) random(0, 100)));
int[] count = new int[100];
for(int i = 0; i < list.size(); i ++) {
count[list.get(i)] ++;
}
for(int i = 0; i < count.length; i ++) {
rect(i * 6, height, 6, -count[i] * 6);
}
}
I'm thinking that it might be the use of
Integer?
Also, this is just test code... it certainly isn't fully optimized...
A while ago, I was inspired by Chrisir's post
here.
I have created my own shape generator, "Vertexator",
on OpenProcessing.
In addition to Chrisir's implementation, it allows you to select and modify vertices, and to copy the necessary code to the clipboard upon pressing the spacebar.
The clipboard functionality is only available with a signed jar, so you may have to give permission for it to run...
Am I mistaken, or was the forum just down for an hour?
I tried accessing it from three different computers, two web browsers, and two networks.
It appears that it's back online now...
Based on what it says in the
Tool Basics wiki, it looks like Processing 2.0 is going to have a Tool / Library Installer built into the PDE. I just noticed this, becuase for the past couple of days, I had been working on writing just that.
Does anyone know more about this?
Has the development already been started?
Would what I already have be useful to the development of Processing 2.0?
If this is the wrong place for me to be asking about Processing 2.0 development, please feel free to say so.
I am currently developing a drawing program in which users can create multiple layers.
The layers are complex datatypes that contain a PGraphics instance.
The program is built using Android, if that's relevant.
I want the users to be able to duplicate the layers.
I have tried several approaches.
Simply assigning the duplicate to the original does not work because it will copy the path to the instance, not the instance itself.
I have tried both using the Cloneable interface, doing it to all classes needed and creating an extended version of PGraphics, as well as Serialization, but PGraphics does not implement Serializable, so I had to rewrite that.
In either scenario, it would be necessary to use a class other than PGraphics. Because of this, createGraphics() can no longer be used to initialize the PGraphics.
I have also looked at the createGraphics() source code, but could find no easy way to rewrite it.
If you know of a better solution, or perhaps one that Processing provides to solve this, I would like to know what it is.
Thank you.
Hello, guys-
I've been working on this application Hex Doodler for a while, and now I have finally put it up on the Android Market.
It can be found for free
here.
From the title, it should be obvious that it is still in beta- so I am open to suggestions as well as any bug reports.
I have currently only been able to test it on my GTab, and it runs fine on that...
Note that this was developed on a tablet and might look fairly squished on a smaller device.