2

Like above, my build.gradle file cannot sync because it could not find property "jni" on source sets "main". I'm using gradle-experimental:0.7.0. I wan't to use Android.mk file in compilation, but i cannot set srcDirs = []. My build.gradle:

model {
android {
    def globalConfiguration = rootProject.extensions.getByName("ext")

    compileSdkVersion = globalConfiguration.getAt("androidCompileSdkVersion")
    buildToolsVersion = globalConfiguration.getAt("androidBuildToolsVersion")

    defaultConfig {
        applicationId "com.example.ndk"
        minSdkVersion.apiLevel globalConfiguration.getAt("androidMinSdkVersion")
        targetSdkVersion.apiLevel globalConfiguration.getAt("androidTargetSdkVersion")
        versionCode globalConfiguration.getAt("androidVersionCode")
        versionName globalConfiguration.getAt("androidVersionName")
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles.add(file('proguard-android.txt'))
//            signingConfig signingConfigs.release
        }
    }

    sourceSets {
        def commonTestDir = 'src/commonTest/java'
        test {
            java.srcDir commonTestDir
        }
        androidTest {
            java.srcDir commonTestDir
        }
        main {
            jni.srcDirs = []
        }
    }
}

 android.ndk {
     moduleName = 'mymodule'
 }
}
unibax99
  • 77
  • 8

1 Answers1

0

Take a look into the plugin Experimental Plugin User Guide, according to it, to specify the source directory, you have to do it like so:

model {
    android {
        ...

        sources {
            main {
                jni {
                    source {
                        srcDir "src"
                    }
                }
            }
        }
    }
}

It's not the way you did it. Take a look, here is the sources property used, but not the sourceSets

Stanislav
  • 27,441
  • 9
  • 87
  • 82