【问题标题】:transformNativeLibsWithStripDebugSymbolForRelease execution failed with mips64el-linux-android-striptransformNativeLibsWithStripDebugSymbolForRelease 执行失败,mips64el-linux-android-strip
【发布时间】:2019-01-21 20:27:02
【问题描述】:

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

【问题讨论】:

    标签: android android-studio android-ndk


    【解决方案1】:

    原因:

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

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

    选项 1:

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

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

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

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

    或者如果您使用的是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 的剥离:

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

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

    【讨论】:

    • local.properties中已经配置好了,我也下载了旧版本的ndk,还是一样的错误
    • 尝试添加abiFilter排除mips
    • 我应该如何以及在哪里添加它们?
    • ffmpeg4android库的主要问题
    • 谢谢兄弟。这对我帮助很大。
    【解决方案2】:

    我在尝试打开旧项目时遇到了同样的问题, 我通过删除 Android SDK 路径 Android/sdk/ndk 中的 ndk 文件夹解决了这个问题。 然后成功运行项目。

    【讨论】:

      猜你喜欢
      • 2019-03-26
      • 2017-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-18
      • 1970-01-01
      • 2017-09-18
      • 2019-11-06
      相关资源
      最近更新 更多