如何为特定的cpu体系结构创建apk文件

时间:2016-10-24 08:33:37

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

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

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

1 个答案:

答案 0 :(得分:0)

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 your required cpu architecture
                              }
                        }
                    }

然后同步gradle并构建apk,将只找到armeabi-v7a和x86的库文件。