Gradle build Error:Cause: org.gradle.api.internal.ExtensibleDynamicObject

后端 未结 3 1541
太阳男子
太阳男子 2021-01-17 11:28

I am trying to import \'https://code.google.com/p/android-serialport-api/\'into Android Studio. Since this project involves ndk, I followed the instructions to build NDK fro

相关标签:
3条回答
  • 2021-01-17 11:50

    I got this error when I had a parameter not correctly moved from old gradle syntax to new one

    (had cFlags "..." rather than CFlags += "...")

    Have a look e.g. at http://tools.android.com/tech-docs/new-build-system/gradle-experimental

    0 讨论(0)
  • 2021-01-17 11:55

    Can you try change

    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    

    to

    compileSdkVersion = 22
    buildToolsVersion = "22.0.1"
    

    and

    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
    

    to

    release {
        minifyEnabled = false
        proguardFiles  += file('proguard-rules.txt')
    }
    

    I've got the same error and this works for me.

    0 讨论(0)
  • 2021-01-17 12:08

    Unfortunately the NDK preview implementation to support native code development in Android Studio is a moving target. Even if you use an older, developers.android.com stated, "supported" combination of the experimental Android Gradle plugin (from tools.android.com) and Gradle version (from gradle.org), good luck in getting the build to work. Instead, always use the latest released combination with the latest indicated module build.gradle language syntax, according to developers.android.com.

    In your case, your mixing the use of assignment operators, "=" and "+=". Depending on the supported combo of gradle plugin and gradle version you're using, it's either use the assignment operators everywhere in module build.gradle file or nowhere - you have to be consistent, all or nothing. For "+=" use the method ".add(...)" instead.

    And remember, the gradle scripting language is compiled to the Java runtime so when you see a build error that looks like a Java error, it's the gradle scripting that is likely the problem.

    0 讨论(0)
提交回复
热议问题