android - Android NDK 平台不支持 ABI [armeabi, mips]

标签 android android-studio android-ndk java-native-interface

我在我的项目中使用 JNI 代码和 abiFilters 如下

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.intel.hellojni"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                cppFlags ""
            }
        }
        ndk {
            abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:+'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

它在一个系统中工作正常,但在将代码移动到其他系统后,它显示以下导入错误,我已经检查了新创建的项目它有同样的错误

ABIs [armeabi, mips] are not supported for platform. Supported ABIs are [armeabi-v7a, arm64-v8a, x86, x86_64].

Build command failed.
Error while executing process F:\sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\Intel\Downloads\TestJNI\app -BC:\Users\Intel\Downloads\TestJNI\app\.externalNativeBuild\cmake\debug\armeabi -DANDROID_ABI=armeabi -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Intel\Downloads\TestJNI\app\build\intermediates\cmake\debug\obj\armeabi -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=F:\sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=F:\sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=F:\sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja}
 (include)   CMakeLists.txt 
Open File
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

如果我像下面那样删除 armeabimips 那么它就可以工作了

ndk {
       abiFilters "armeabi-v7a", "x86"
}

我已经为 android studio 安装了 CMake 和 NDK。

最佳答案

如消息所述,NDK 不再支持这些 ABI。 NDK r17 changelog 中提到了这一点:

Support for ARMv5 (armeabi), MIPS, and MIPS64 has been removed. Attempting to build any of these ABIs will result in an error.

正如其他人所说,没有大量设备可以从针对这些 ABI 中的任何一个中受益。

关于android - Android NDK 平台不支持 ABI [armeabi, mips],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52233971/

相关文章:

android - 在 Android Studio 的模拟器中出现白屏

任务 ':app:packageAllDebugClassesForMultiDex' 的 Android Studio 执行失败

android - 如何找出哪些类不能被 ProGuard Android 解析

android - 在 Android Studio 中,ndk-build 下的 CMAKE_VERBOSE_MAKEFILE 是什么?

android - 什么时候应该使用 RxJava Observable,什么时候应该在 Android 上使用简单的 Callback?

java - gradle 同步时出错

android - 带有 Android NDK 的 header

android - 无法使用 Android Studio (1.3 RC) 找到 ARM64 NDK native 库

android - 谷歌地图在当前位置设置标记

android - ConstraintLayout 防止顶部和底部小部件重叠