Status Update
Comments
js...@google.com <js...@google.com> #2
Hi, was this a regression after you upgrade your NDK or upgrade your Android Studio?
je...@google.com <je...@google.com> #3
Neither of them. There were no change to AS (4.1-RC1) nor NDK versions.
I just changed my old scripts in build.gradle to the android recommended method i.e.
externalNativeBuild { ndkBuild { path file('jni/Android.mk') } }
If I reverted the change to my old script, everything is working again. The old scripts uses
ndk.dir=/opt/android/android-sdk/ndk-bundle
as defined in local.properties file
The source.properties files indicate the version as:
Pkg.Desc = Android NDK Pkg.Revision = 21.3.6528147
tc...@google.com <tc...@google.com> #4
Hi, the problem is that when Android Gradle Plugin executes ndk-build, it is missing the '-C' + projectDir + '/jni'
part in your custom task. Therefore, the current working directory is the module root (parent of the jni
directory). Hence the error.
The fix is to add the following to your build.gradle
android {
...
defaultConfig {
...
externalNativeBuild {
ndkBuild {
arguments "-Cjni"
}
}
}
}
Please reopen the bug if you have further issues. Thanks!
js...@google.com <js...@google.com> #5
Please provide the full syntax for the externalNativeBuild scripts. gradle sync throws the following error message when I added the recommended argument statement to the script (or change to arguments('-Cjni'))
A problem occurred evaluating project ':aTalk'.
No signature of method: build_6xrerbyg3j4aatiomvrbavr6i.android() is applicable for argument types: (build_6xrerbyg3j4aatiomvrbavr6i$_run_closure4) values: [build_6xrerbyg3j4aatiomvrbavr6i$_run_closure4@497bb461]
externalNativeBuild {
ndkBuild {
path file('jni/Android.mk')
arguments "-Cjni"
}
}
je...@google.com <je...@google.com> #6
There are actually two different types of exteranlNativeBuild
blocks. The block in #4 needs to be put inside defaultConfig
android {
...
defaultConfig {
...
externalNativeBuild {
ndkBuild {
arguments "-Cjni"
}
}
}
...
externalNativeBuild {
ndkBuild {
path file('jni/Android.mk')
}
}
}
Description
The
kotlinCompilerVersion
flag was needed back when we were shipping our own custom build of the Kotlin compiler. Since we are now using the stock upstream compiler, this should no longer be necessary.I think by default, if you don't specify
kotlinCompilerVersion
, AGP currently swaps in some really old version of our custom build. We should instead have the default behavior be to not swap out the Compiler anymore, and just use whatever version of Kotlin the developer already has.We might want to consider removing the flag altogether, since it is error-prone (people could specify conflicting Kotlin versions and be confused) and we don't intend to use it anymore (except extenuating circumstances, which probably we don't want to support anyway).
Related conversation in Slack:https://kotlinlang.slack.com/archives/CJLTWPH7S/p1601585917345500