本文介绍了transformNativeLibsWithStripDebugSymbolForRelease 执行失败,mips64el-linux-android-strip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在android studio中遇到这个错误,请知道如何解决它的人告诉我

I am getting this error in android studio, please anyone know how to solve it let me know

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

推荐答案

原因:

根据 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 或更高版本.

如上所述:


As said above:

更新您的项目文件以使用插件版本 3.1 或更高版本.您还需要升级到 Android Studio 3.1 或更高版本.

直接解决方案是:

从您的 TOP-LEVEL build.gradle将您的 android gradle 插件的类路径更改为 3.2.1 或更高版本.

From your TOP-LEVEL build.gradle, change your classpath for android gradle plugin to 3.2.1 or higher.

classpath 'com.android.tools.build:gradle:3.2.1'

但是,如果您想坚持使用现有的 Gradle 插件版本,解决方法/解决方案如下:


But, if you want to stick to your existing Gradle plugin version, the workarounds/solutions are as below:

选项 1:

ndk-17 以来,不再有 mips 架构.因此,您可以降级您的 NDK(对于旧版本的 NDK,请从此处查看:https://developer.android.com/ndk/downloads/older_releases)或添加 abiFilters 以排除 mips ABI.

There is no more mips architecture since ndk-17. So, you can either downgrade your NDK (for older versions of NDK, please check from here: https://developer.android.com/ndk/downloads/older_releases) or add abiFilters to exclude mips ABIs.

看到您正在使用 ndk-bundle,这是 Android Studio 的默认 ndk 路径设置.您可以从 local.properties 配置此路径,使其指向您的 NDK 版本,例如r16b,而不是默认的 ndk-bundle.

Seeing that your are using ndk-bundle which is the default ndk path settings of Android Studio. You can configure this path from local.properties making it point at your NDK version, e.g. r16b, rather than the default ndk-bundle.

ndk.dir=<path>/android-ndk-r16b
sdk.dir=<path>/sdk

选项 2:

使用以下配置仅过滤必要的 ABI.

Using below configuration to only filter the necessary ABIs.

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'
        }
    }
}

或者如果你使用的是 cmake

buildTypes {
    debug {
        externalNativeBuild {
            cmake {
                abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
            }
        }
    }
    release {
        externalNativeBuild {
            cmake {
                abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
            }
        }
    }
}

选项 3:

另一种解决方法是使用以下配置跳过 mips 的剥离:

Another workaround is to skip the stripping of mips using below configuration:

android {
    ...
    packagingOptions{
        doNotStrip '*/mips/*.so'
        doNotStrip '*/mips64/*.so'
    }
    ...
}

根据您的情况选择最佳选项.

Choose the best option for your case.

这篇关于transformNativeLibsWithStripDebugSymbolForRelease 执行失败,mips64el-linux-android-strip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 11:26