Android運行X86模擬器

1、libs中有armeabi-v7a和x86目錄及so文件
如果:
app的build.gradle中配置

ndk {
	abiFilters "armeabi-v7a"
}

Terminal中運行./gradlew installDebug
則報錯:

> Task :app:installDebug FAILED
06:15:10 V/ddms: execute: running am get-config
06:15:10 V/ddms: execute 'am get-config' on 'emulator-5554' : EOF hit. Read: -1
06:15:10 V/ddms: execute: returning
Skipping device 'Pixel_2_API_28(AVD) - 9' for 'app:debug': Could not find build of variant which supports density 420 and an ABI in x86

FAILURE: Build failed with an exception.

關注錯誤信息:
Could not find build of variant which supports density 420 and an ABI in x86

1.1 刪除libs目錄下x86目錄,結果報錯同上。

1.2 刪除libs目錄下x86目錄,修改app的build.gradle爲:

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

報錯信息如下:

Unable to install /Users/xxx/AndroidStudioProjects/NDKTest
/app/build/outputs/apk/debug/app-debug.apk
com.android.ddmlib.InstallException: 
INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113

2、abiFilters作用
2.1 當用於C++源碼編譯打包時,作用是:只生成指定的so文件。
2.2 當用於加載so包時,作用是:只加載指定的so文件。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章