“设备支持 x86,但 APK 只支持 armeabi-v7a”错误的原因是什么

我正在使用 Android Studio 测试一些来自 GitHub 的项目,当我试图模拟 apk 时,它不允许我选择模拟器。

它告诉我:

设备支持 x86,但 APK 只支持 armeabi-v7a

为什么会这样?

69090 次浏览

Test your code on real phone. If you have still same issue,then import your code again and before this you should update your SDK and create a new emulator with ARM system image.

Device supports x86, but APK only supports armeabi-v7a)

Sounds like you used an x86 image in the emulator.

Create a separate one. Choose "other images" tab to find arm devices, if you have to.

Or, run on an actual device. The repo you listed is meant to run on a Raspberry Pi 3 / ODroid, I think.

I had the same problem, I checkout the build.gradle from module:app. It turns out that there's a such config:

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

when I commented all out, everything worked fine.

I was trying to deal with the React Native Android project.

In my case my app use some native libraries. Each platform requires the corresponding libs to be built.

So the native lib of x86(or any other) platform is not generated.You must have add an abifilter somewhere:

There are several places where abi filters can be specified:

  • Application.mk add the platform you need like this:

    APP_ABI := armeabi armeabi-v7a x86
    
  • build.gradle

    find abiFilters, and add platform you need like this:

    abiFilters   "armeabi","armeabi-v7a","x86"
    

On Linux: File > Invalidate Cache / Restart On phone: Instead Charge this device change to Transfer photos (PTP)

In Android Studio, select the Build menu,

enter image description here

then click Select Build Variant... and in 'Build Variants' window select x86Debug(or release)

enter image description here

PS: Im using Android Studio 2.3 on Mac

I had the similar issue and I've resolved it by adding "x86" value to the "abiFilters" list like below -

[Open build.gradle(Module: app) file ] and search for "ndk" in deafultSection and add "x86" to it!

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

Hope it helps!!!

Just go to device Settings >> Developer Options >> Restore Default Settings then enable USB debugging

Turn off USB debugging and turn it back on the hardware device.

On my physical device, I started getting this. The fix was to go into Developer Settings and turn off and on USB debugging.

Can confirm, toggling USB debugging off/on in Developer Options resolved the issue. Maybe even cancel the "Select Deployment Target" window in Android Studio and try to run the app again after toggling USB debugging.

Many times this means that you have not granted your laptop/computer access to your device. Take a look at your device and click the "Allow Access" button as well as the debugging permissions.

For me it worked my changing the cable option from

-> Charge Only.

To

-> Transfer file.

In my case of Linux machine adb devices showed

List of devices attached
44b194f5    no permissions

Then restarted the adb server

sudo adb kill-server

and then

sudo adb start-server

then connect your device turn Debugging on and type

adb devices
List of devices attached
44b194f5    device

Finally was able to run on the device

Running an AVD using the x86 processor is 10x faster than using the ARM emulator, but most of the time you are only compiling your APK for ARM. To have faster emulation runs using an x86 AVD I had to do the following (for a Cocos2d-x project):

  • app/jni/Android.mk

    APP_ABI := armeabi-v7a:x86
    
  • gradle.properties

    PROP_APP_ABI=armeabi-v7a:x86
    
  • app/build.gradle

    android {
    ...
    defaultConfig {
    ...
    ndk {
    abiFilters = []
    abiFilters.addAll(PROP_APP_ABI.split(':').collect{it as String})
    }
    }
    }
    

If you use Ubuntu:

  1. make sure that usb debugging is ON
  2. check your cable connection
  3. on notification bar check android system notification and touch it for change charging state to file transfer
  4. now go terminal and type: adb devices after run this command adb restart and your device show in list

adb kill-server

adb start-server

Its working for me on windows OS.

Restarting device solved problem for me (React-native)

You need to reconnect your device and try to turn off/on the developer options.

See Enable developer options and debugging

It happened to me to after updating the Android Studio. In my case, it happened because of the build setting is not automatically configured into x86Debug-x86. Just change it by opening Build>>Select Build Variant>> Change the build variant option from armeabi-v7a into x86Debug-x86 or whatever you need in the emulator.

Try enabling Unknown Sources from Security Options. It worked for me.

i see this

If you’re using CMake for your builds, then check the file \proj.android\gradle.properties, and update the PROP_APP_ABI to include the builds for x86, or alternatively, you could just use the armeabi-v7a or arm64-v8a Android images.

Example: PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86

If you’re not using cmake, then look in \proj.android\app\jni\Application.mk in case you need to change the ABI setting in there.

The code below worked for me:

ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'
}

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