OF_android : gradle sync failed : unknow property assembleDebug


#1

Hi :smile:
I try the androidImageExample but gradle fail to sync :confused:
I use the gradle plugin version 2.2.0 and Ndk 13.0. and OF 0.9.3.

When trying to sync, I have this error :
Error:(58, 0) Could not get unknown property ‘assembleDebug’ for root project ‘androidImageExample’ of type org.gradle.api.Project.
Open File
for the line : assembleDebug.dependsOn(":openFrameworksProject:compileDebugOF") in the build.gradle file from the project.

But when I follow the path, I find the task compileDebugOF in the build.gradle file from /libs/openFrameworksCompiled/project/android.
So I don’t understand why gradle doesn’t found the task…
And there was no error for the clean.dependsOn(":openFrameworksProject:clean") line above assembleDebug.dependsOn(":openFrameworksProject:compileDebugOF") :confused:

Thanks for helping me :slight_smile:


#2

Ok, I don’t know what was the problem, but I tried with OF version 0.9.4 and it works :slight_smile:
Sorry for annoying you :slight_smile:


#3

I have the same problem described in first post with OF 0.9.5.

Thanks


#4

I’m hitting this with 0.9.6


#5

unfortunately have same problem with 9.4!!!


#6

I also hit same problem before (using OF 0.9.8) when I changed the android gradle plugin from 1.3.1 (this is default from AndroidEmptyExample) to 2.2.2. I think its more because there are something change in Android plugin 2.2.2 (not sure though)…

Anyway, I can run the androidEmptyExample project by using the gradle 2.2.1 (as explained in https://developer.android.com/studio/releases/gradle-plugin.html) and android gradle plugin version 1.3.1 (the default one)


#7

[SOLVED] Gradle 2.2.2 requires update in build.gradle

I had the same problem with OF 0.9.8 + Gradle 2.2.2 update.
Gradle 2.2.2 requires an update to the project’s build.gradle file.

build.gradle: current doesn’t work with Gradle 2.2.2

assembleDebug.dependsOn(":openFrameworksProject:CompileDebugOF")
assembleRelease.dependsOn(":openFrameworksProject:CompileReleaseOF")

build.gradle: updated for 2.2.2

afterEvaluate {
    assembleDebug.dependsOn(":openFrameworksProject:CompileDebugOF")
    assembleRelease.dependsOn(":openFrameworksProject:CompileReleaseOF")
 }

Reference

https://code.google.com/p/android/issues/detail?id=219732#c32


#8

I was having this issue still with the afterEvaluate fix in and I managed to work around it by commenting out the

assembleRelease.dependsOn(":openFrameworksProject:CompileReleaseOF")

When building and running on the device straight from Android Studio. I figured it out from this thread where they were talking about being able to build the apk and install but not run it directly in debug mode below and I’m not Android savvy enough to really know whats going on, but just to save anyone some pain.

https://github.com/tensorflow/tensorflow/issues/8587


#9

Just in case someone need it. For latest Gradle replace those lines:

//assembleDebug.dependsOn(":openFrameworksProject:compileDebugOF")
//assembleRelease.dependsOn(":openFrameworksProject:compileReleaseOF")

with this:

tasks.whenTaskAdded { task ->
    if (task.name == 'assembleDebug') {
        task.dependsOn ':openFrameworksProject:compileDebugOF'
    }
}

tasks.whenTaskAdded { task ->
    if (task.name == 'assembleDebug') {
        task.dependsOn ':openFrameworksProject:compileReleaseOF'
    }
}

#10

Thanks, that helped me


#11

Shouldn’t the second condition be (task.name == ‘assembleRelease’) ?
I would appreciate your confirm.


#12

Yeah, of course it should. Just a victim of copy-paste :slight_smile:


#13

The other option here.

oF 0.9.8 is designed for Android Plugin for Gradle 1.3.1 (see yourProject/build.gradle)
We can not change this version number otherwise we should change all gradle syntax like many comments above. (e.g. assembleDebug)
To use this plugin, we need Gradle version 2.2.1 - 2.9.
https://developer.android.com/studio/releases/gradle-plugin.html
(Yes, Android Plugin for Gradle and Gradle is different stuff.)
But if we open Android Studio it try to update Gradle to latest version like 3.3 (this is stored in yourProject/gradle folder).

You can fix this by changing distributionUrl to 2.2.1 (at yourProject/gradle/wrapper/gradle-wrapper.properties)

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

Tested on OSX, Android Studio 2.3.3, of_v0.9.8_android_release