Ami*_*ail 4 android android-ndk android-studio
我在android studio中收到此错误,请有人知道如何解决它让我知道
Execution failed for task ':q84sale-base:transformNativeLibsWithStripDebugSymbolForRelease'.
> A problem occurred starting process 'command '/Users/amira/Library/Android/sdk/ndk-bundle/toolchains/mips64el-linux-android-4.9/prebuilt/darwin-x86_64/bin/mips64el-linux-android-strip''
Run Code Online (Sandbox Code Playgroud)
shi*_*hen 12
原因:
根据https://github.com/android-ndk/ndk/wiki/Changelog-r18#known-issues
此版本的NDK与Android Gradle插件3.0或更早版本不兼容.如果您看到类似错误
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android,请更新您的项目文件以使用插件版本3.1或更新版本.您还需要升级到Android Studio 3.1或更高版本.
如上所述:
更新您的项目文件以使用插件版本3.1或更高版本.您还需要升级到Android Studio 3.1或更高版本.
直接解决方案是:
从您的TOP-LEVEL build.gradle,将Android gradle插件的类路径更改为3.2.1或更高版本.
classpath 'com.android.tools.build:gradle:3.2.1'
Run Code Online (Sandbox Code Playgroud)
但是,如果您想坚持使用现有的Gradle插件版本,那么解决方法/解决方案如下:
选项1:
mips从那以后就没有更多的架构了ndk-17.因此,您可以降级NDK(对于旧版本的NDK,请从此处查看:https://developer.android.com/ndk/downloads/older_releases)或添加abiFilters以排除mipsABI.
看到你正在使用ndk-bundle这是Android Studio的默认ndk路径设置.您可以配置此路径,local.properties使其指向您的NDK版本,例如r16b,而不是默认值ndk-bundle.
ndk.dir=<path>/android-ndk-r16b
sdk.dir=<path>/sdk
Run Code Online (Sandbox Code Playgroud)
选项2:
使用以下配置仅过滤必要的ABI.
android {
// Similar to other properties in the defaultConfig block, you can override
// these properties for each product flavor in your build configuration.
defaultConfig {
ndk {
// Tells Gradle to build outputs for the following ABIs and package
// them into your APK.
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
}
}
Run Code Online (Sandbox Code Playgroud)
或者如果您正在使用 cmake
buildTypes {
debug {
externalNativeBuild {
cmake {
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
}
}
release {
externalNativeBuild {
cmake {
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
选项3:
另一种解决方法是使用以下配置跳过mips的剥离:
android {
...
packagingOptions{
doNotStrip '*/mips/*.so'
doNotStrip '*/mips64/*.so'
}
...
}
Run Code Online (Sandbox Code Playgroud)
为您的案例选择最佳选择.
| 归档时间: |
|
| 查看次数: |
6134 次 |
| 最近记录: |