OF on Android Studio 3.0

Hello,

Have anyone get OF to work with Android Studio 3.0? I am willing to be a guinea pig :slight_smile: to try out.

Thx,
Tom

Hey @ppngiap, these steps should work for you in Android Studio 3.0 (or should be at least very similar): https://medium.com/@ire_alva/getting-started-with-openframeworks-on-android-5202b92f6582

Would be curious to know what doesn’t work if that’s not the case…

Hi @irene, I download the latest android release and and overwrite libs/openFrameworksCompiled/project/android/* with the corresponding content from git master branch. The error is that the plugin ‘com.android.model.native’ not found – see below. I google around and can’t find a repository that I can download the plugin from. --Tom

/Users/tphan/dev/of/of_v0.9.8_android_release/libs/openFrameworksCompiled/project/android/build.gradle

Error:(9, 0) Plugin with id ‘com.android.model.native’ not found.
Open File

I might have to update the tutorial, the NDK updated recently. Try using NDK version r15c: https://github.com/openframeworks/openFrameworks/blob/master/docs/android_studio.md

Hi @irene, I am able to build and run the sample app per the tutorial, thank you. Two things I observe, when I try to build the APK, I get the error that I should use Gradle 3.5 or later. And the output is very small on my Google Pixel. --Tom

Information:Gradle tasks [:assembleArm7Debug]
Error:Failed to complete Gradle execution.

Cause:
The version of Gradle you are using (3.3) does not support the forTasks() method on BuildActionExecuter. Support for this is available in Gradle 3.5 and all later versions.

With respect to the output size - refer to the original tutorial I had shared. The “Fixing the screen resolution” sections should help you out with that.

With respect to your gradle problem - I’m not totally sure what’s going on… When I have more time I can try building the example project with the new NDK in android studio 3. For now, stack overflow might contain some clues. Checkout this post for example. Also make sure you checkout the troubleshooting section in the OF github. There are some notes on gradle versions.

Hi!
I´ve been doing some tests with Android S. 3.0.1, cloning OF from github and I was able to build the projects modifying the graddle version with:

distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip

in gradle-wrapper.properties and

buildscript {
apply from: “…/…/…/libs/openFrameworksCompiled/project/android/ndk-verify.gradle”

repositories {
    jcenter()
}
dependencies {
    // Using the gradle-experimental version that supports c++
    classpath 'com.android.tools.build:gradle-experimental:0.9.3'
}

}

in build.gradle (AndroidImageExample)

I was able to run in my OnePlus without problem, but cannot build the APK since I don´t know how to solve this problem:

Error:Failed to complete Gradle execution.

Cause:
The version of Gradle you are using (3.3) does not support the forTasks() method on BuildActionExecuter. Support for this is available in Gradle 3.5 and all later versions.

If I change to 3.5 I receive this error:

Gradle sync failed: Gradle version 3.3 is required. Current version is 3.5. If using the gradle wrapper, try editing the distributionUrl in /Users/federico/Documents/openFrameworks/examples/android/androidImageExample/gradle/wrapper/gradle-wrapper.properties to gradle-3.3-all.zip

I´m a complete noob in android development and OF was a great opportunity to begin working on it!

1 Like