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
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
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.
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.