平台android NDK不支持ABI[armeabi,mips]
我在我的项目中使用JNI代码和平台android NDK不支持ABI[armeabi,mips],android,android-studio,android-ndk,java-native-interface,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
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!
如果我像下面那样删除armeabi
和mips
,那么它就工作了
ndk {
abiFilters "armeabi-v7a", "x86"
}
我已经为android studio安装了CMake和NDK。正如消息所说,NDK不再支持这些ABI。这在以下文件中提到: 已删除对ARMv5(armeabi)、MIPS和MIPS64的支持。尝试构建任何这些ABI都将导致错误
正如其他人所说,没有多少设备可以从这些ABI中获益。NDK不再支持armeabi。从build gradle上拆下armeabi或更换
使用支持的ABI,例如“x86”从
build.gradle
文件中的abiFilters
中删除'armebi
。
NDK不再支持armebi。正确的列表可以是:
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
在Windows10上使用Android Studio 4.1.1时也会出现同样的问题。更改build.gradle中的版本修复程序,例如。 从…起 classpath“com.android.tools.build:gradle:4.1.1” 到
classpath“com.android.tools.build:gradle:4.0.0”。这是有意的。NDK r17发行说明中写道:“对ARMv5(armeabi)、MIPS和MIPS64的支持已被删除。尝试构建任何这些ABI都将导致错误。”MIPS和MIPS64 Android设备几乎不存在。而支持armeabi但不支持armeabi-v7a的Android设备在2010年左右就不再流行了。@Michael,现在只使用“ABI过滤器”armeabi-v7a、“x86”是否省钱?是的。然而,从2019年8月开始,为32位ABI(armeabi-v7a,x86)提供本机库的应用程序也将被要求为相应的64位ABI(arm64-v8a,x86_64)提供这些库。即使2019年之前不再需要,64位ABI通常比32位ABI的性能更好。