【问题标题】:How to create apk file for specific cpu architecture如何为特定的 cpu 架构创建 apk 文件
【发布时间】:2016-10-24 08:33:36
【问题描述】:

我已经知道 gradle 上可用的 split 选项,它为不同的 cpu 架构生成多个 apk。

如何生成仅包含 armeabi-v7a 和 x86 架构的 apk?

【问题讨论】:

标签: android android-studio android-gradle-plugin apk cpu-architecture


【解决方案1】:
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 的库文件。

【讨论】:

  • 第一步:考虑改进答案的格式。 code 段仅使用 4 个空格。 预览窗口存在是有原因的!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-15
  • 1970-01-01
  • 1970-01-01
  • 2015-11-17
  • 1970-01-01
相关资源
最近更新 更多