问题
AS升级到3.0.0后,jni中文件包含有类似 #include <string>
指令时,报cannot find string
解决
原 gradle
android {
publishNonDefault true
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 14
versionName '4.1.0'
externalNativeBuild {
ndkBuild {
abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'arm64-v8a'
cppFlags '-std=c++11'
}
}
...
新 gradle
android {
publishNonDefault true <-remove
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 14
targetSdkVersion 14
versionName '4.1.0'
externalNativeBuild {
ndkBuild {
abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'arm64-v8a' <-remove
cppFlags '-std=c++11' <-remove
}
}
...
原因
由于gradle4.1在gradle中导入的语法由
debugCompile project(path: ':xxx', configuration: 'debug')
releaseCompile project(path: ':xxx', configuration: 'release')
更新为
implementation project(path: ':xxx')
因此不再需要使用 publishNonDefault true
指定打包版本
网友评论