首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Google Play:捆绑包未签名

Google Play:捆绑包未签名
EN

Stack Overflow用户
提问于 2021-09-17 10:28:03
回答 2查看 1.2K关注 0票数 0

我在Kotlin中创建应用程序,我支付了谷歌开发人员帐户。但是在上传.aab文件时有一些问题:The Android App Bundle was not signed。我阅读了Stackoverflow上关于它的所有主题,并尝试了所有解决方案。对我不起作用。build.gradle中的signingConfig signingConfigs.release以这个错误结尾:Could not get unknown property 'release' for SigningConfig。只有当我设置了signingConfig时,它才起作用。我还使用了这个:minifyEnabled falsedebuggable = false。那么,我还必须尝试什么呢?2021年有什么新的解决方案吗?!

我的build.gradle:

代码语言:javascript
复制
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 31
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId '...'
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.00"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        manifestPlaceholders["hostName"] = "..."
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig
            debuggable = false
        }
        applicationVariants.all{
            variant ->
                variant.outputs.each{
                    output->
                        def name = "...apk"
                        output.outputFileName = name
                }
        }
    }
    buildFeatures{
        dataBinding = true
        viewBinding = true
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
    implementation 'com.github.amitshekhariitbhu.Fast-Android-Networking:android-networking:v1.0.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

}
EN

回答 2

Stack Overflow用户

发布于 2021-09-17 10:34:45

如何创建带签名的aab文件:

安卓应用包在下一个窗口中选择

  1. (aab)

  1. 现在您必须创建自己的签名密钥。如果您希望将来上载任何更新,则必须使用您在此处创建的签名密钥对其进行签名。

另外,每次更新都需要在build.gradle(app)中增加版本。

编辑1:

将:signingConfig更改为:signingConfig signingConfigs.release并添加以下内容:

代码语言:javascript
复制
    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

完整的代码:

代码语言:javascript
复制
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 31
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId '...'
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.00"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        manifestPlaceholders["hostName"] = "..."
    }
    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
            debuggable = false
        }
        applicationVariants.all{
            variant ->
                variant.outputs.each{
                    output->
                        def name = "...apk"
                        output.outputFileName = name
                }
        }
    }
    buildFeatures{
        dataBinding = true
        viewBinding = true
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
    implementation 'com.github.amitshekhariitbhu.Fast-Android-Networking:android-networking:v1.0.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

}

编辑2:

我刚刚用这个build.gradle(app)把项目aab上传到了Google Play

代码语言:javascript
复制
plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

android {
    compileSdk 31

    defaultConfig {
        applicationId "pfhb.damian.uploadtest"
        minSdk 28
        targetSdk 31
        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
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.6.0'
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
票数 0
EN

Stack Overflow用户

发布于 2021-09-17 11:00:06

您必须创建签名配置版本,希望这将工作。

代码语言:javascript
复制
  plugins {
        id 'com.android.application'
        id 'kotlin-android'
        id 'kotlin-android-extensions'
        id 'com.google.gms.google-services'
    }
    
    //repositories { maven { url 'https://maven.cashfree.com/release' } }
    
    android {
        compileSdkVersion 30
        buildToolsVersion "30.0.3"
    
        defaultConfig {
            applicationId "com.xyz.medicine"
            minSdkVersion 27
            targetSdkVersion 30
            versionCode 4
            versionName "1.0"
            multiDexEnabled true
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
    
        // Please check if you have this block or not
    
         signingConfigs {
                release {
                    storeFile file('../secrets/keystore.jks')
                    storePassword 'DUMMYPASSWORD'
                    keyAlias 'DUMMYALIAS'
                    keyPassword 'DUMMYPASSWORD'
                }
            }
    
        buildTypes {
            release {
                resValue "string", "BASE_URL", "https://obhaiyya.com/proMaid/"
                shrinkResources true
                minifyEnabled true
                debuggable false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                signingConfig signingConfigs.release
            }
            debug {
                shrinkResources false
                minifyEnabled false
                debuggable true
                signingConfig signingConfigs.debug
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        kotlinOptions {
            jvmTarget = '1.8'
        }
        buildFeatures {
            viewBinding true
            buildFeatures {
                dataBinding true
            }
        }
    
    
    }
    
    dependencies {
    
        implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
        implementation 'androidx.core:core-ktx:1.5.0'
        implementation 'androidx.appcompat:appcompat:1.3.0'
        implementation 'com.google.android.material:material:1.4.0'
        implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
        implementation 'com.google.firebase:firebase-messaging-ktx:22.0.0'
        testImplementation 'junit:junit:4.+'
        androidTestImplementation 'androidx.test.ext:junit:1.1.2'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
        implementation "com.airbnb.android:lottie:3.7.1"
        
    
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69221853

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档