Unbound inputs and/or subjects


(Mark Anderson) #1

Morning, I am struggling with a project that was working under a previous version of Gradle however no longer. Currently using 4.1
It’s been a few days now going in circles, any help would be appreciated.

My error is as follows -
Error:The following model rules could not be applied due to unbound inputs and/or subjects:

Line 6 > android {
Line 56 > android.buildTypes {
Line 42 > android.ndk {
Line 19 > android.productFlavors {

The gradle file as follows -

apply plugin: 'com.android.library'

def basedir = projectDir.absolutePath

model {
  android {
    compileSdkVersion = 22
    buildToolsVersion = "27.0.3"

    defaultConfig.with {
        minSdkVersion = 22

        targetSdkVersion = 22
        versionCode = 1
        versionName = "1.0"
    }

}
android.productFlavors {
    create("armv7") {
        ndk.abiFilters.add("armeabi-v7a")
        String libsDir = "${basedir}/src/jniLibs/armeabi-v7a/"
        ndk.ldLibs.addAll([
                libsDir + "libopencv_legacy.a",
                libsDir + "libopencv_calib3d.a",
                libsDir + "libopencv_features2d.a",
                libsDir + "libopencv_flann.a",
                libsDir + "libopencv_imgproc.a",
                libsDir + "libopencv_highgui.a",
                libsDir + "libopencv_contrib.a",
                libsDir + "libopencv_objdetect.a",
                libsDir + "libopencv_core.a",
                libsDir + "libtbb.a",
                libsDir + "liblibtiff.a",
                libsDir + "liblibpng.a",
                libsDir + "liblibjpeg.a",
                libsDir + "liblibjasper.a",
                libsDir + "libIlmImf.a",
        ])
    }
}
android.ndk {
    moduleName = "biocore"

    stl = "gnustl_shared"

    cppFlags.add("-std=c++11")
    cppFlags.add("-frtti")
    cppFlags.add("-fexceptions")

    cppFlags.add("-I${basedir}/src/main/headers".toString())
    cppFlags.add("-iquote${basedir}/src/main/jni".toString())

    ldLibs.addAll(["android","log","atomic","z"])
}
android.buildTypes {
    debug {
        minifyEnabled = false
    }
    release {
        minifyEnabled = false
    }
}
}
dependencies {
}

android {
compileSdkVersion 22
buildToolsVersion '27.0.3'
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
defaultConfig {
    minSdkVersion 22
    targetSdkVersion 22
}
productFlavors {
}
}

(Mark Anderson) #2

Ok I think I have fixed this error that I have mentioned by ;

Removing the model { section and also then removing android. off the front of each subsequent group.

However I now have a different error as follows ;

Cannot invoke method (add) on null object

    productFlavors {
    create("armv7") {
        ndk.abiFilters.add("${basedir}/src/main/jniLibs/armeabi-v7a")

thanks