简体   繁体   English

从生产APK中排除jniLibs文件夹

[英]Exclude jniLibs folder from Production APK

My app has a dev and production flavor defined in Gradle. 我的应用程序具有在Gradle中定义的开发和生产风格。 In my production flavor, I would like the resulting APK file to NOT have my x86 jniLibs binaries. 在我的制作风格中,我希望得到的APK文件没有我的x86 jniLibs二进制文件。 I only use them for testing in genymotion, and some of them are large so I really need the space. 我只使用它们在genymotion中进行测试,其中一些很大,所以我真的需要空间。

The only way I can get this to kinda work is by manually deleting my src/main/jniLibs/x86 folder then building, but I then have to do this every time I build, and then restore the libs later. 我可以通过手动删除我的src / main / jniLibs / x86文件夹然后构建来实现这一目标的唯一方法,但是每次构建时我都必须这样做,然后在以后恢复库。 Is there a simpler way using gradle/proguard/something? 有没有更简单的方法使用gradle / proguard / something?

Here is the configuration to exclude x86 SO file for RELEASE build variant: 以下是为RELEASE构建变体排除x86 SO文件的配置:

android {
    buildTypes {
        release {
            ndk {
                abiFilters "armeabi-v7a", "armeabi" // includes ARM SO files only, so no x86 SO file
            }
        }
    }
}

And, there is x86 SO in the "debug" build variant output since no filter is set. 并且,“debug”构建变量输出中有x86 SO,因为没有设置过滤器。

将lib从app/src/main/jniLibs/x86app/src/debug/jniLibs/x86

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM