【发布时间】:2016-10-24 08:33:36
【问题描述】:
我已经知道 gradle 上可用的 split 选项,它为不同的 cpu 架构生成多个 apk。
如何生成仅包含 armeabi-v7a 和 x86 架构的 apk?
【问题讨论】:
标签: android android-studio android-gradle-plugin apk cpu-architecture
我已经知道 gradle 上可用的 split 选项,它为不同的 cpu 架构生成多个 apk。
如何生成仅包含 armeabi-v7a 和 x86 架构的 apk?
【问题讨论】:
标签: android android-studio android-gradle-plugin apk cpu-architecture
Step 1: Add the class path dependency to the project level build.gradle file.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:3.7.1"
}
}
Step 2: Apply the realm-android plugin to the top of the application level build.gradle file.
apply plugin: 'realm-android'
Step3: Add this to the application’s build.gradle:
realm {
syncEnabled = true;
}
Step4:Add this to the application’s build.gradle:
android{
defaultConfig{
applicatioId "com.android.abi.myapplication"
minSdkVersion 16
targetSdkVersion 25
ndk{
abiFilters "armeabi-v7a", "x86" // Add only required cpu architectures here
}
}
}
然后同步 gradle 并构建 apk ,将只找到 armeabi-v7a 和 x86 的库文件。
【讨论】: