在我的应用中包括64位库,但是当我分析apk时,它仍然是32位

时间:2019-11-16 04:53:27

标签: android android-studio android-support-library

apply plugin: 'com.android.application'

android {     编译版本29     defaultConfig {         applicationId“ com.panache.fm”         minSdkVersion 16         targetSdkVersion 29         版本代码4         versionName“ 1.3”         multiDexEnabled是         testInstrumentationRunner“ android.support.test.runner.AndroidJUnitRunner”

    manifestPlaceholders = [onesignal_app_id               : "77d104e0-6665-4288-a324-b74296fe24d4",
                            // Project number pulled from dashboard, local value is ignored.
                            onesignal_google_project_number: "REMOTE"]

    ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
buildTypes.each {
    it.buildConfigField 'String', 'SERVER_URL', SERVER_URL
}
sourceSets {
    main {
        res.srcDirs = ['src/main/res', 'src/main/res/assets', 'src/main/assets', 'src/main/res/drawable-hdpi', 'src/main/res/drawable-mdpi', 'src/main/res/drawable-xhdpi', 'src/main/res/drawable-xxhdpi', 'src/main/res/values-sw600dp', 'src/main/res/values-sw720dp-land', 'src/main/res/values-v14', 'app/libs/armeabi', 'libs/armeabi', 'libs/armeabi-v7a', 'src/main/jniLibs', 'src/main/jniLibs/armeabi', 'src/main/jniLibs/armeabi-v7a', 'libs/mips', 'libs/x86']
    }
}

}

依赖项{     实现fileTree(dir:'libs',包括:['* .jar'])     androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2',{         排除组:“ com.android.support”,模块:“ support-annotations”     })     // noinspection GradleCompatible     实施'com.android.support:appcompat-v7:28.0.0'     // noinspection GradleCompatible     实施'com.android.support:cardview-v7:28.0.0'     实现'com.android.support.constraint:constraint-layout:1.1.3'     // noinspection GradleCompatible     实施'com.android.support:design:28.0.0'     // noinspection GradleCompatible     实施'com.android.support:recyclerview-v7:28.0.0'     实施'com.google.android.gms:play-services-ads:15.0.1'     实施'com.google.android.gms:play-services-gcm:15.0.1'     实施'com.google.firebase:firebase-core:16.0.1'     实施'com.google.firebase:firebase-messaging:17.0.0'     testImplementation'junit:junit:4.12'     实施项目(路径:':slider')     实现'com.onesignal:OneSignal:3.9.1'     实施'com.squareup.picasso:picasso:2.71828'     实现“ uk.co.chrisjenx:书法:2.3.0”     实施项目(路径:':RadioLibrary')     实施'com.google.android.ads.consent:consent-library:1.0.4'     实施'com.makeramen:roundedimageview:2.3.0'     实现'com.pkmmte.view:circularimageview:1.1'     实施'com.sothree.slidinguppanel:library:3.4.0'     实现'com.github.castorflex.smoothprogressbar:library-circular:1.3.0'     实现'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:0.7.2'     实施'com.labo.kaji:relativepopupwindow:0.3.1'     实施'com.google.android.exoplayer:exoplayer:2.8.1'     实施'fr.baloomba:viewpagerindicator:2.4.2'     实现'com.github.iammert:MaterialIntroView:1.5.2'     实施'org.apache.commons:commons-lang3:3.4'     // noinspection GradleCompatible     实施'com.android.support:preference-v7:28.0.0'     实现'com.android.support:multidex:1.0.3'     实施项目(':library') } 应用插件:“ com.google.gms.google-services”

1 个答案:

答案 0 :(得分:1)

将您的gradle更改为此:

    android { 
           compileSdkVersion 29 
           defaultConfig { 
           applicationId "com.panache.fm" 
           minSdkVersion 16 
           targetSdkVersion 29 
           versionCode 4 
           versionName "1.3" 
           multiDexEnabled true 
           testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

            manifestPlaceholders = [onesignal_app_id               : "77d104e0-6665-4288-a324-b74296fe24d4",
                                    // Project number pulled from dashboard, local value is ignored.
                                    onesignal_google_project_number: "REMOTE"]

        }

    splits {
            abi{
                enable true
                reset()
                include 'x86_64','x86','armeabi','armeabi-v7a','arm64-v8a'
                universalApk true
            }

        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }

更新

这两个配置不能一起设置。因此,您有两种选择:

  1. 禁用拆分APK(您已经知道了)。比起您将有一个APK。
  2. 删除ndk.abiFilters设置。比起您将有多个APK(可能更小)。此外,如果universalApk为true,则将生成具有所有体系结构的通用APK(可能比选项1大得多)。