Triple-T / gradle-play-publisher

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
MIT License
4.13k stars 341 forks source link

Can't publish flavour bundles on Play Store. #802

Closed harshmandan closed 4 years ago

harshmandan commented 4 years ago

I have several flavours uploaded on Play Store. I set up this library to auto publish everything, but I've been getting this error where name of the package is mis-matching.

Here's my build.gradle:

plugins {
    id 'com.android.application'
    id 'com.github.triplet.play' version '2.1.0'
}

apply plugin: 'com.android.application'

def versionCode = '12'

def versionName = '1.8 beta'

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

play {
    defaultToAppBundles = true
    serviceAccountCredentials = file("gpp-key.json")
}

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.myorg"
        minSdkVersion 17
        targetSdkVersion 29
        versionCode felVersionCode.toInteger()
        versionName felVersionName
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    flavorDimensions "version"

    productFlavors {
        flavourOne {
            applicationIdSuffix ".app1"
            play {
                track = "beta"
                userFraction = 1
            }
        }

        flavourTwo {
            applicationIdSuffix ".app2"
            play {
                track = "beta"
                userFraction = 1
            }
        }

        flavourThree {
            applicationIdSuffix ".app3"
            play {
                track = "beta"
                userFraction = 1
            }
        }
    }

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

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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.12'

    implementation 'com.google.firebase:firebase-analytics:17.2.1'

    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.firebase:firebase-auth:19.2.0'

    implementation 'com.google.firebase:firebase-database:19.2.0'

    implementation 'com.google.firebase:firebase-messaging:20.0.0'

    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'

}
apply plugin: 'com.google.gms.google-services'

When I run gradlew publishBundle This is the output I get:

> Task :app:stripFlavourTwoReleaseDebugSymbols UP-TO-DATE
WARNING: Compatible side by side NDK version was not found. Default is 20.0.5594570.
Compatible side by side NDK version was not found. Default is 20.0.5594570.

> Task :app:publishFlavourTwoReleaseBundle FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:publishFlavourTwoReleaseBundle'.
> File 'D:\myproj\app\build\outputs\bundle\flavourTwoRelease\app.aab' specified for property 'bundle' does not exist.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s

Info: com.android.tools.build:gradle:3.6.0

harshmandan commented 4 years ago

Its looking for app.aab in the folder where as the bundle generated has the name app-flavourTwo-release.aab

So the full path for the file is: D:\myproj\app\build\outputs\bundle\flavourTwoRelease\app-flavourTwo-release.aab

SUPERCILEX commented 4 years ago

v2.1.0 is waaaaaaaaaaaaay too old and I'm pretty sure this has been fixed. If you still have troubles with v2.7.5, please ping me.