android - 无法生成发布构建 apk

标签 android android-studio gradle google-play google-play-console

我有一个具有此build设置的项目:
项目有单独的调试变体

 applicationIdSuffix '.debug'
versionNameSuffix '-DEBUG' 
在发布时,显示了许多构建变体。
但我是一名初学者开发人员,所以需要你们确定,哪一个是我需要发布的调试构建变体?
那么其他构建变体会做什么呢?
该项目包括许多模块(如 3rd Party Sample Project )
 buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        //noinspection GradleDynamicVersion
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'

repositories {
    maven { url 'https://maven.fabric.io/public' }

    maven {
        url 'some url/'

        credentials {
            username 'someusername'
            password 'somepassword'
        }
    }
}

// for Crashlytics
apply plugin: 'io.fabric'


// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file("keystore.properties")

// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()

// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))


android {

//    applicationVariants.all { variant ->
//         //(variant.buildType.name == 'release') {
//            variant.mergeAssetsProvider.configure {
//                doLast {
//                    delete(fileTree(dir: outputDir, includes: ['**/*.pdf']))  // '**/js',
//                }
//            }
//        //}
//    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

    lintOptions {
        checkReleaseBuilds true
        abortOnError true
        //warningsAsErrors true

        baseline file("lint-baseline.xml")
        fatal 'StopShip'

    }

    compileSdkVersion 28
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.application.sanchyan"
        versionName "3.1.8.4"

        versionCode 18
        targetSdkVersion 28

        vectorDrawables.useSupportLibrary = true
        renderscriptSupportModeEnabled true
        renderscriptTargetApi 19
        multiDexEnabled true

        

    }

    buildTypes {
        debug {
            applicationIdSuffix '.debug'
            versionNameSuffix '-DEBUG'
            //minifyEnabled true

            // By using a special debug ProGuard file, you can turn off obfuscation, which would
            // otherwise hinder debugging.
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro',
                    'proguard-rules-debug.pro'

        }

        release {
            minifyEnabled true
            //shrinkResources true

            signingConfig signingConfigs.release

            //multiDexKeepFile file('multidex-config.txt')

            //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'


       

            ext.enableCrashlytics = true

            //
            // IMPORTANT PART:
            //
            // tell your MultiDex to keep the classes you defined in your Proguard .pro file.
            //multiDexKeepProguard file('proguard-rules.pro')
        }
    }

    flavorDimensions "region", "mode", "api"

    productFlavors {

//        Read these to understand the whole concept better:
//       li
//        https://proandroiddev.com/advanced-android-flavors-part-1-building-white-label-apps-on-android-ade16af23bcf


        // API

        pre21 {
            dimension "api"
            minSdkVersion 19
            versionNameSuffix ""

        }

        post21 {
            dimension "api"
            minSdkVersion 21
            versionNameSuffix ""
        }




        // MODE

        full {
            dimension "mode"
        }

        demo {
            dimension "mode"
            applicationIdSuffix '.demo'
            versionNameSuffix " [Demo]"
        }

        internal {
            dimension "mode"
            applicationIdSuffix '.internal'
            versionNameSuffix " [Internal]"
        }




        // REGION

        brigon {
            dimension "region"
            applicationIdSuffix '.brigon'
        }

        uei {
            dimension "region"
            applicationIdSuffix '.uei'
        }

        uk {
            dimension "region"
            versionNameSuffix ""
        }




    }

    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {



    implementation 'com.android.support:multidex:1.0.3'
    implementation project(':polygonview')
    implementation project(':tabbuttonview')
    implementation project(':imagetoggleview')
    implementation project(':wedgeview')
    implementation project(':panzoomview')
    implementation project(':flowlayout')
    implementation project(':infoview')
    implementation project(path: ':utilities')
    implementation 'androidx.appcompat:appcompat:1.1.0'     // 1.1.0-rc01
    /*  beta2 causes issues with layouts not showing content till updating (eg DevicePicker)  */
    
    //noinspection GradleDependency
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3'   // 2.0.0-beta1
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.material:material:1.2.0-alpha02'      // 1.1.0-alpha09
    implementation 'com.google.firebase:firebase-core:17.2.1'      // 17.0.0
    implementation 'com.google.firebase:firebase-messaging:20.0.1'
    implementation 'com.google.firebase:firebase-perf:19.0.2'
    implementation 'com.google.maps.android:android-maps-utils:0.6.2'
    implementation 'com.pacioianu.david:ink-page-indicator:1.3.0'
    implementation 'com.squareup.moshi:moshi:1.9.2'

    //noinspection GradleDependency
    pre21Implementation 'com.squareup.okhttp3:okhttp:3.14.4'
    post21Implementation 'com.squareup.okhttp3:okhttp:4.2.2'
    //implementation 'com.squareup.okhttp3:okhttp:3.14.4'



    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'org.apache.commons:commons-text:1.8'


    // for Crashlytics
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation 'com.crashlytics.sdk.android:answers:1.4.7'


    // for PSPDFKit
    implementation 'com.pspdfkit:pspdfkit:6.0.3'
    implementation 'androidx.palette:palette:1.0.0'


    // for Chrome web content
    implementation 'com.android.support:customtabs:28.0.0'

    // for image cropping
//    implementation 'com.github.yalantis:ucrop:2.2.4-native'
    implementation 'com.github.yalantis:ucrop:2.2.4'



    //    implementation 'com.androidplot:androidplot-core:0.9.4'

    // Room components
    //    implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
    //    annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"
    //    androidTestImplementation "android.arch.persistence.room:testing:$rootProject.roomVersion"

    // Lifecycle components
    implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion"
    //annotationProcessor "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion"
    implementation "android.arch.lifecycle:common-java8:1.1.1"


    testImplementation 'junit:junit:4.13-rc-2'
    testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.1'
    releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
    //noinspection GradlePath
    implementation files('C:/Users/Dell/Documents/ProjectFilePath/libs/YouTubeAndroidPlayerApi.jar')

}

apply plugin: 'com.google.gms.google-services'
并且发布构建时间显示的错误是
Missing org.conscrypt.ConscryptHostnameVerifer
我不知道将来会发布多少错误。
请帮帮我

最佳答案

read this topic
And this one
在阅读信息消息时,它让我对此有所了解 Conscrypt并做了研究,发现我需要安装conscrypt到我的 gradle.app

implementation 'org.conscrypt:conscrypt-android:2.2.1'
它有效。

关于android - 无法生成发布构建 apk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62608785/

相关文章:

android - android studio 1.4中content_main.xml的作用是什么?

java - Visual Studio Code 无法识别 java 项目

android - 如何通过 Android Studio Gradle 构建复制或使用 native 库?

android - e : [kapt] An exception occurred: android. databinding.tool.util.LoggedErrorException: 发现数据绑定(bind)错误

Android 不同的 packageName 和 flavors

缺少 Android Studio 文件选项卡

android - PluginApplicationException : Failed to apply plugin class 'FlutterPlugin'

SQLite3 存储只包含数字的字符串

Android 辅助功能 - 无法专注于 Appbar 中的任何元素

android - 依赖项、模块的问题。如何正确引用该库?