android studio - 使用构建 apk 或发布功能后 apk 太多

android studio - too many apks after using build apk or release feature

我正在尝试 通过 android 工作室中的构建 apk 功能 构建一个 apk。但我发现了类似 附加图像 的内容。我从来没有发现过这种应用程序,而且我不知道这是怎么发生的。任何人都可以解释这些 apk 是什么以及为什么会这样吗?

我的 build.gradle 文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.0"

    defaultConfig {
        applicationId "com.sakhawat.youtubedownloader"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

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

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

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

}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
// circle image view
implementation 'de.hdodenhof:circleimageview:2.1.0'

//lottie animation loader
implementation 'com.airbnb.android:lottie:2.5.0-rc1'

//youtube play library
implementation 'com.github.yausername.youtubedl-android:library:0.12.+'
implementation "com.devbrackets.android:exomedia:4.3.0"

//rx android
implementation "io.reactivex.rxjava2:rxandroid:2.1.0"

//google admob
implementation 'com.google.android.gms:play-services-ads:19.3.0'

}

您的 build.gradle 文件似乎包含拆分块。

请阅读this了解更多信息。

[编辑]

正如我在上面告诉您的那样,您的 build.gradle 文件似乎包含一个拆分块。 所以这里是

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

请注释掉此块,然后再次尝试构建 apk,并让我们知道生成的 APK。