NDK开发时配置以及编写难免会出现错误:以下是我在NDK配置以及编写是出现的错误 和解决方法
以下是log日志里的错误
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugNdk'.
> Error: Flag android.useDeprecatedNdk is no longer supported and will be removed in the next version of Android Studio. Please switch to a supported build system.
Consider using CMake or ndk-build integration. For more information, go to:
https://d.android.com/r/studio-ui/add-native-code.html#ndkCompile
To get started, you can use the sample ndk-build script the Android
plugin generated for you at:
D:\Demo\NDK\NDemo\app\build\intermediates\ndk\debug\Android.mk
Alternatively, you can use the experimental plugin:
https://developer.android.com/r/tools/experimental-plugin.html
To continue using the deprecated NDK compile for another 60 days, set
android.deprecatedNdkCompileLease=1530683631447 in gradle.properties
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
上面代码意思告诉你
android.useDeprecatedNdk=true
这行代码在android中已经过时了,那怎么解决呢,其实日志里后面已经给我们解决方法了:
To continue using the deprecated NDK compile for another 60 days, set
android.deprecatedNdkCompileLease=1530683631447 in gradle.properties
意思是继续使用已弃用的NDK编译60天,并且在设置了一个时间戳,
android.deprecatedNdkCompileLease=1530683631447
把你log日志里的这句话替换 android.useDeprecatedNdk=true 就可以了!
我想60天也够用了, 不够用的话在替换一次