从apk中排除abi [英] Exclude abi from apk

查看:213
本文介绍了从apk中排除abi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我使用了具有x86,armeabi-v7a和mips(每个约2.7Mb)的本机代码的renderscript。另外我读了mips架构只有几个设备。因此,我想将我的应用程序捆绑到两个APK中:通用(例如x86和armeabi-v7a)和mips。我发现分割部分有助于为mips创建apk,但通用apk仍然包含mips体系结构。所以我的问题是如何从结果apk排除abi?



谢谢

解决方案

您可以尝试设置另一种包含除MIPS之外的所有内容。在 build.gradle 文件,它是Android Gradle插件源代码的一部分,我发现它是这样的:

  apply from:../commonHeader.gradle
buildscript {apply from:../commonBuildScript.gradle,to:buildscript}
应用插件:'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion = rootProject.ext.buildToolsVersion
productFlavors {
x86 {
ndk {
abiFilterx86
}
}
arm {
ndk {
abiFiltersarmeabi-v7a,armeabi


mips {
ndk {
abiFiltermips
}
}
}
}

看起来它们基本上是 arm 包括两个常见的ARM ABI。你可以定义一个包含 x86 armeabi-v7a 的通用风格。



他们有另一个测试项目,其 build.gradle 包含:

<$ p $
abi {
abi {
enable true
reset()
include'x86','armeabi-v7a','mips'
}
}

您可能可以使用类似的东西, c $ c> mips 。


In my application I use renderscript which has native code for x86, armeabi-v7a and mips (~2.7Mb each). Also I read that the mips architecture has just a few devices. So I'd like to bundle my application in two APKs: universal (eg. x86 and armeabi-v7a) and mips. I found that split section helps to create apk for mips, but universal apk still contains mips architecture. So my question is how to exclude abi from result apk?

Thanks

解决方案

You can try setting up another flavor that contains everything but MIPS. In the build.gradle file from one of the test projects that are part of the Android Gradle plugin sources, I found this:

apply from: "../commonHeader.gradle"
buildscript { apply from: "../commonBuildScript.gradle", to: buildscript }
apply plugin: 'com.android.application'
android {
    compileSdkVersion 21
    buildToolsVersion = rootProject.ext.buildToolsVersion
    productFlavors {
        x86 {
            ndk {
                abiFilter "x86"
            }
        }
        arm {
            ndk {
                abiFilters "armeabi-v7a", "armeabi"
            }
        }
        mips {
            ndk {
                abiFilter "mips"
            }
        }
    }
}

It looks like their arm flavor basically includes the two common ARM ABIs. You could probably define an "universal" flavor containing x86 and armeabi-v7a.

They have another test project, whose build.gradle contains:

splits {
    abi {
        enable true
        reset()
        include 'x86', 'armeabi-v7a', 'mips'
    }
}

You might be able to use something similar, and drop the mips from there.

这篇关于从apk中排除abi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆