解决“More than one file was found with OS independent path 'lib/armeabi-v7a/xxx.so”

“More than one file was found with OS independent path 'lib/armeabi-v7a/xxx.so"这个问题是项目中导入了多个so库重复导致的,一般场景就是项目依赖了库,又依赖了相关的.aar,在编译的时候不报错,但是在打包安装的时候gradle就会报错,具体解决方法就是在gradle中配置packagingOptions ,配置其首选项


  packagingOptions {
        pickFirst "lib/armeabi-vxx/xxx.so"  //路径根据自己具体报错而定
    }

根据的报错的提示,将pickFirst 后面的路径换成提示的路径即可。


gradle中的packingOptions具体的java实现

 /**
     * Specifies options and rules that determine which files the Android plugin packages into your
     * APK.
     *
     * <p>For more information about the properties you can configure in this block, see {@link
     * PackagingOptions}.
     */
     指定用于确定Android插件将哪些文件打包到您的APK中的选项和规则
    public void packagingOptions(Action<PackagingOptions> action) {
        checkWritability();
        action.execute(packagingOptions);
    }

发布了117 篇原创文章 · 获赞 56 · 访问量 29万+

猜你喜欢

转载自blog.csdn.net/Jiang_Rong_Tao/article/details/105197756
今日推荐