1. Modify the build.gradle file of app
// ApK productFlavors {aaqianfanyidong32{Dimension "default" applicationId = "com.qianfanyidong. Forum "versionCode 23231 versionName "5.0.9" signingConfig signingConfigs. Aaqianfanyidong minSdkVersion 21 the NDK {abiFilters' armeabi - v7a '} } aaqianfanyidong64{dimension "default" applicationId = "com.qianfanyidong. Forum "versionCode 23231 versionName "5.0.9" signingConfig signingConfigs.aaqianfanyidong minSdkVersion 21 ndk{ abiFilters 'armeabi-v8a' } } }Copy the code
Because our project is special, we need to modify the productFlavors folder name as well. Otherwise, the build can’t find the resource file
The complete code is as follows:
apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android { compileSdkVersion rootProject.compileSdkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } aaptOptions { cruncherEnabled = false } defaultConfig { minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.targetSdkVersion multiDexEnabled = true vectorDrawables.useSupportLibrary = true } //mark-sign signingConfigs { aaqianfanyidong { keyAlias 'qianfan' keyPassword '123456' storePassword '123456' storeFile file("qianfanyidong.jks") } } //mark-sign buildTypes { release { // Set the signature to Release debuggable false zipAlignEnabled true // Whether to enable zip optimization minifyEnabled true // Whether to enable obfuscation useProguard True ShrinkResources false// This property is confused with minifyEnabled, ProguardFiles getDefaultProguardFile(' proGuard-android.txt ') 'ProGuard-rules.pro'} //mark-debug debug {debuggable true versionNameSuffix "-debug" zipAlignEnabled false // Whether zip is optimized MinifyEnabled false useProguard false shrinkResources false minifyEnabled / / delete some useless resources configuration files used in the signature signingConfig signingConfigs. Aaqianfanyidong proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'} //mark-debug} lintOptions {// Prevent Build Failed due to MissingTranslation! abortOnError false checkReleaseBuilds false disable 'MissingTranslation' } sourceSets { main { jniLibs.srcDirs = ['libs'] } } dexOptions { preDexLibraries = false javaMaxHeapSize "6g" } flavorDimensions "default" //mark-flavors productFlavors { aaqianfanyidong32{ dimension "default" applicationId = "com.qianfanyidong.forum" versionCode 23231 VersionName "5.0.9 signingConfig signingConfigs. Aaqianfanyidong minSdkVersion 21 / / reference website optimization the NDK build speed https://developer.android.com/studio/build/optimize-your-build {abiFilters' armeabi - v7a '}} Aaqianfanyidong64 {dimension "default" applicationId = "com.qianfanyidong. Forum "versionCode 23231 versionName "5.0.9" signingConfig signingConfigs.aaqianfanyidong minSdkVersion 21 / / reference website optimization the NDK build speed https://developer.android.com/studio/build/optimize-your-build {abiFilters' armeabi - v8a '}}} //mark-flavors dataBinding { enabled = true } } allprojects { repositories { jcenter() } } repositories { mavenCentral() maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url "https://jitpack.io" } flatDir { dirs 'libs', '.. /hmspush/libs', '.. /gdtlib/libs', '.. /rongmedia/libs', '.. /tongdun/libs','.. /baidu/libs' } flatDir { dirs ".. /${rootProject.ext.ccb_project_name}/src/main/lib" } } buildscript { repositories { mavenCentral() } } dependencies { Implementation fileTree (include: [' *. Jar '], dir: 'libs') implementation' androidx. Multidex: multidex: 2.0.1 '... }Copy the code
2. Build
3. The analysis
After the build is complete, you can analyze whether the APK is correct by using the tools in Android Studio
Then select the target APK to see if it is 32 or 64 bits in the lib folder
Reference: blog.csdn.net/javazejian/…