我正在尝试构建连接我的 Pixel 手机的应用。我最近将我的手机升级到 Android 8。在上次升级之前,我能够在我的手机中构建和打开应用程序,但是在这次升级之后,我得到失败 [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113 ] 错误。
下面是我的 gradle 文件。有人可以告诉我这是什么问题吗??
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "com.my.app.googlemaps"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
...
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
最佳答案
它有同样的问题,它在替换一个apache库(commons-io)后工作了一个不同的commons-io,那是来自另一个bundle。
在切换到新的开发设备(Pixel Phone w/Android 8.0 Oreo)后,我遇到了这个问题。
解决方案1
在您的情况下,您可以停止使用文件系统中的本地 jar (compile fileTree(include: ['*.jar'], dir: 'libs')
) 并使用适当的 gradle 依赖项来自 bintray(例如)。
原始 gradle 依赖项(抛出与您描述的相同的错误):
错误: 失败 [INSTALL_FAILED_NO_MATCHING_ABIS:无法提取 native 库,res=-113]
dependencies {
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'commons-cli:commons-cli:1.4'
}
使用适当的 commons-io
Artifact 处理 build.gradle
:
dependencies {
...
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
...
}
Ignore the different dependency notation, it doesn't matter
解决方案2
您定义了多个目标 ABI,您是否检查过您的设备支持哪一个。也许您必须添加另一个,以与您的设备 ABI 兼容。
您可以在 Application.mk
中定义它们
另见:
- https://developer.android.com/ndk/guides/abis.html
- https://developer.android.com/ndk/guides/application_mk.html
- http://androidlad.blogspot.com/2016/10/installfailednomatchingabis-when.html
- [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
- INSTALL_FAILED_NO_MATCHING_ABIS when install apk
关于android - Android 8 上的 INSTALL_FAILED_NO_MATCHING_ABIS 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46094281/