2

I'm creating app in Kotlin and I paid Google developer account. But there is some problem with upload .aab file: The Android App Bundle was not signed. I readed all topics at Stackoverflow about it and tried all solutions. Not works for me. signingConfig signingConfigs.release in build.gradle ends with this error: Could not get unknown property 'release' for SigningConfig. It works only when I set signingConfig. I'm using also this: minifyEnabled false and debuggable = false. So what another I must to try? There exists some new solution for year 2021?!

My build.gradle:

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'

}
djlj
  • 31
  • 2
  • 6
  • Does this help - [link](https://developer.android.com/studio/publish/app-signing#sign_release) – Nitish Sep 17 '21 at 10:30
  • Thanks, but that's exactly what I'm doing. – djlj Sep 17 '21 at 10:44
  • Can you add your build types present in the class. build.gradle – Nitish Sep 17 '21 at 10:48
  • I edited my original question. Thanks again! – djlj Sep 17 '21 at 10:54
  • Does this answer your question? [Error on uploading app to play console- "Upload failed The Android App Bundle was not signed ."](https://stackoverflow.com/questions/55860354/error-on-uploading-app-to-play-console-upload-failed-the-android-app-bundle-wa) – Sweta Jain Sep 23 '21 at 08:30
  • My problem is really solved by this link: https://developer.android.com/studio/publish/app-signing - "Export encrypted key" is my solution. – djlj Sep 24 '21 at 09:07

3 Answers3

13

I had the same issue when I set "debuggable true" for release build type variant,

pls ensure "debuggable false" is set for release type.

buildTypes {
    release {
        minifyEnabled true
        debuggable false

}

himans
  • 201
  • 2
  • 7
1

Step by step how to create signed aab file:

  1. First step

  2. In the next window select Android App Bundle (aab)

  3. Now you have to create your own signing key. If you want upload any update in the future, you must sign it with this signing key you created here.

Also every update you need to increment version in build.gradle(app).

Edit 1:

Change: signingConfig to: signingConfig signingConfigs.release and add this:

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

The full code:

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'

}

Edit 2:

I just uploaded the project aab to Google Play with this build.gradle(app):

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

You have to create signing config release, Hope this will work. Let me know if you want to know how to create this block will be more happy to help you.

  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"
        
    
    }
  • Yes! This build.gradle solves my problem with `Could not get unknown property 'keystoreProperties'`. But upload to Google Play still not works. – djlj Sep 17 '21 at 11:42
  • Have you created .jks file ? If not then follow this step : 1. Generate keystore,jks file - add all necessary details such as name , state etc 2. Generate .aab means bundle Android app bundle. - make sure to change version code before creating this bundle. Let me know if it doesn't work with above mentioned steps. – vijay kumar Sep 17 '21 at 16:21
  • Yes, I created jks file. I used it to sign apk for install from file on new Android 11. I tried to create new project and create new jks file and aab file. Result in Play Console is still the same. Change version code? Where? – djlj Sep 17 '21 at 21:27
  • defaultConfig { applicationId "com.obhaiyya.vaidshalahealth" minSdkVersion 27 targetSdkVersion 30 versionCode 4 versionName "1.0" multiDexEnabled true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } In the default config block module app gradle version code : increase version code by 1 every time when you want to upload new apk – vijay kumar Sep 18 '21 at 06:20
  • I understand. But this is still my first upload. Or unsuccessfull try is counted as upload too? BTW: I changed `applicationId` yesterday. – djlj Sep 18 '21 at 07:42