I’m following this guide https://github.com/openframeworks/openFrameworks/blob/master/docs/android.md in order to run the androidEmptyExample. I’m using mac, Android Studio and the OF release 0.9 for android (of_v20150910). I’ve installed the sdk and downloaded the ndk, as explained in the tutorial. I’ve adjusted the local.properties adding the ndk path and I’ve solved some missing dependencies through the Android Studio dialogs. After finishing the whole installation I’ve tried to build the example and I’ve got the following error:
Error:(146, 1) Execution failed for task ':ofAndroidLib:compileReleaseOF'.
> make failed with exit status 2
In the log I’ve noticed that there is a file not found
/bin/sh: /Users/da1/Library/Android/android-ndk-r9d/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86/bin/arm-linux-androideabi-g++: No such file or directory
Actually the release r9d suggested in the wiki does not contain the folder arm-linux-androideabi-4.9. Maybe the wiki is not updated?
I will try now if the release r10b contains the missing folder
I’ve tried with the latest nightly build too (20150917) and it still fails.
With the ndk r9d I’ve the same problem as before.
Using the r10b ndk the folder arm-linux-androideabi-4.9 is present, but another file can not be found
Information:(2) (Unknown) In file included
Error:(9, 26) stdint.h: No such file or directory
The folder android-ndk-r10b/prebuilt/darwin-x86_64/lib does not contain the gcc folder.
thanks @Prof_Sparkles for your reply.
It looks like the tutorial is not up-to-date.
Even with the last ndk, I was not able to run the example, I’ve added the the error on this issue https://github.com/openframeworks/ofSite/issues/315
Which version of OF and Android Studio are you using?
On which emulator are you testing the app?
What I ended up doing is the suggested manual method if importing the build file doesnt work.
When you can successfully compile, go to examples/android/emptyExample and copy the build.gradle to the example you want to compile. Then open up the settings.gradle with any text editor or Android Studio, which you used to import the project in the first place (from …/project/android/).
At the bottom in that file you can see a line that includes the emptyExample project which you just compiled. You can just use the same scheme by just replacing emptyExample with touchExample f.e.
There is also a comment that explains how you import project folders from the myApps folder.
When you did that re-sync the project and you will have a new compile target in the top bar that has the name of the imported example.
I’ve followed the steps on the tutorial https://github.com/openframeworks/openFrameworks/blob/master/docs/android_studio.md
until “Build and Run”. It takes around 3 minutes to compile, the builds finishes and i can run the emulator. I do not see anything except the android desktop in the amulator, but the log looks good
DEVICE SHELL COMMAND: pm install -r “/data/local/tmp/cc.openframeworks.androidEmptyExample”
In order to try out the examples, i do the following, i copy “the generated android app”, that I assume is OF/apps/myApps/androidEmptyExample to “a subdirectory of apps, at the same level as the sample”, that I assume is OF/apps/myApps. And here the problem, double clicking on build.gradle opens the AndroidStudio dialog. I can not check the option “Use local gradle wrapper”, but I’ve to specify a local one, that I don’t have. Also, i do not have a settings.gradle file that I can edit on the copied project folder.
I think I will try Eclipse, Android Studio seems still too experimental.
I’ve copied the build.gradle file from OF/examples/android/androidEmptyExample to OF/examples/android/androidPolygonExample.
I’ve edited the file OF/openFrameworks/blob/master/libs/openFrameworksCompiled/project/android/settings.gradle adding include 'examples:android:androidPolygonExample' . (I assume that everytime i want to try a different example i will have to edit the same file, right?)
I’ve resynced the project, but the sync fails with this error:
Plugin with id ‘com.android.application’ not found.
Probably because of some missing dependencies. I’ve added these lines to my
I’ve changed the structure of the android studio projects a bit, it’s explained in the readme files, but mainly now you just need to open any project folder in the android examples instead of having to open the main OF project.
let me know if it has any problem.
the new structure is already in github and will be in tomorrow’s nightly build
@edapx I ran into the same issue when opening the build.gradle of the example without including it manually. Weird that it doesn’t work for you neither way but I guess arturo’s edit should help with this.
@Prof_Sparkles@arturo I’ve finally have the androidPolygonExample working using the current branch, and changing the settings.gradle file, adding include 'examples:android:androidPolygonExample'.
The part that I’ve found confusing is that the project that you have to open in Android Studio is OF/openFrameworks/blob/master/libs/openFrameworksCompiled/project/android/settings.gradle, and then you modify this project(editing its settings.gradle file to include other examples, like this one with polygon) and you build it.
The way i was used in OF is to open a project in the examples folder and use it. @arturo is this the way we are supposed to test the android examples?, on which “readme files” are you referring it exaclty?
I can run it only on a physical device, the emulator still does not show nothing, but i think it is something related to the API version used, in the emulator I’ve a virtual device with a shiny new API, my physical one is older.
With this changes now you don’t need to change the main project file in OF/openFrameworks/blob/master/libs/openFrameworksCompiled/project/android anymore. just open the folder of the example you want to run. Check the docs again since there’s a couple of things that need to be change in terms of config but it’s almost the same as before
About the emulator, it seems the first time you run the example it won’t run but then if you press play again leaving the emulator open it’ll run the application fine.
i’ve tested a couple of examples and there’s some problems with the emulator so it’s probably easier to just test everything in the device by now. The new emulator with support for x86 seems much faster than before so in the future i’ll look into making that work better,
The new tutorial looks good!
Everything works, just some troubleshooting that happens to me:
clicking on the console error on Android Studio generally worked, but it was not able to resolve the dependencies of the Android API 22. Opening the sdk manager and install the API 22 solved the problem.
Sometimes the physical android device is not visible anymore by android studio. In this case:
I can add the last one to the Troubleshooting part of the wiki.