INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2

问题

最近碰到个问题,在Android手机上安装apk安装不上,使用adb命令安装后出现以下报错

➜  ~ adb install test.apk 
Failed to install test.apk: Failure [INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2]

分析

从控制台的报错信息来看,这个错误是安装时,提取so失败。你想该apk ,发现该AndroidManifest.xml中

<application android:theme="@style/PortalTheme" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:name="com.xxx.XXXApplication" android:allowBackup="true" android:hardwareAccelerated="true" android:largeHeap="true" android:supportsRtl="true" android:extractNativeLibs="false" android:resizeableActivity="true" android:networkSecurityConfig="@xml/network_security_config" android:roundIcon="@mipmap/ic_launcher" android:appComponentFactory="androidx.core.app.CoreComponentFactory">

有包含属性android:extractNativeLibs="false"

该属性告诉系统,不要把 so 文件从 apk 中解压出来。


解决方法

方法1:

删除属性 android:extractNativeLibs="false";

方法2:

修改属性 android:extractNativeLibs="true";

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值