transformNativeLibsWithStripDebugSymbolForRelease execution failed with mips64el-linux-android-strip

Solution 1:

Reasons:

According to https://github.com/android-ndk/ndk/wiki/Changelog-r18#known-issues

This version of the NDK is incompatible with the Android Gradle plugin version 3.0 or older. If you see an error like No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android, update your project file to use plugin version 3.1 or newer. You will also need to upgrade to Android Studio 3.1 or newer.


As said above:

update your project file to use plugin version 3.1 or newer. You will also need to upgrade to Android Studio 3.1 or newer.

The Direct solution is:

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'

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

Option 1:

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.

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

Option 2:

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

Or if you are using cmake

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

Option 3:

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.