本文介绍了INSTALL_FAILED_CPU_ABI_INCOMPATIBLE 在设备上使用 Intellij的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了一些关于此的问题,但没有一个提供真正的答案或详细信息.这是我的情况:

I've seen some questions about this, but none with real answers nor details. Here is my case:

我有一个使用 Google Maps API v2 的应用程序,它运行良好.最近我发现我无法在 这个 非基于 ARM 的设备上安装它.

I have an application that uses Google Maps API v2 which works just fine. Recently I found out that I cannot get it installed on this not ARM-based device.

为了解决这个问题,我正在使用 SDK (\sdk\extras\google\google_play_services\samples) 提供的 Google 地图示例

In order to nail down the problem I'm working with Google Maps samples provided with the SDK (\sdk\extras\google\google_play_services\samples)

在安装时给我同样的错误信息:

which gives me the same error message at install time:

失败 [INSTALL_FAILED_CPU_ABI_INCOMPATIBLE]

我仅在使用 Intellij (12.1.1) 的真实设备上收到此消息

I get this message only on a real device using Intellij (12.1.1)

在真实设备上使用 Eclipse 和在配置了 CPU 的模拟器上使用 Intellij 都可以正常工作:Intel Atom (x86)

It works fine using both Eclipse on real device and using Intellij on the Emulator configured with CPU: Intel Atom (x86)

任何帮助将不胜感激!

更新

不出所料,Android Studio 也会发生同样的事情

As expected, same thing happens with Android Studio

推荐答案

默认情况下,IntelliJ 假定 Android 模块根目录中的 libs 文件夹包含本机库,即使它只包含 jars.因此,它打包了 APK,使其看起来像是本机库.我刚刚遇到了一个类似的问题,我的应用程序没有本机代码并且可以在默认模拟器上运行,但是在 Genymotion 模拟器上安装时收到 ABI 警告.要解决此问题,请告诉 IntelliJ(或 Android Studio)您的库不是本机代码:

By default, IntelliJ assumes that the libs folder in the root of an Android module contains native libraries, even if it just holds jars. Thus, it packages the APK making it look like these are native libraries. I just had a similar issue where my application had no native code and would work on the default emulator, but got the ABI warning when installing on the Genymotion emulator. To fix this, tell IntelliJ (or Android Studio) that your libraries are not native code:

  1. 打开文件 ->项目结构.
  2. 点击窗口左侧的Modules.
  3. 对于每个 Android 模块,展开下拉列表并选择 Android 子项.
  4. 在右侧的 Structure 选项卡中,删除 Native libs directory 字段的内容(您可以将其留空).
  5. 为项目中的每个 Android 模块完成此操作并应用更改后,您可能需要通过选择 Build -> 来重新构建项目以进行更改.从 IntelliJ 的全局菜单重建项目.
  1. Open File -> Project Structure.
  2. Click Modules on the left side of the window.
  3. For each Android module, expand the dropdown and select the Android subitem.
  4. In the Structure tab on the right, delete contents of the Native libs directory field (you can leave it blank).
  5. Once you've done this for each Android module in the project and applied the changes, you may need to rebuild your project for the changes to take place by choosing Build -> Rebuild Project from IntelliJ's global menu.

这篇关于INSTALL_FAILED_CPU_ABI_INCOMPATIBLE 在设备上使用 Intellij的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 17:34