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.1k stars 340 forks source link

Task 'publishFreeReleaseBundle' not found in project ':app'. #976

Closed ArcherEmiya05 closed 3 years ago

ArcherEmiya05 commented 3 years ago

Describe the bug

Good day I am new to this and trying to use GPP in AS locally, I was able to do task like bootstrapListing but when I tried publishFreeReleaseBundle to release a AAB to internal track it does not work.

Note: I already have releases in production track only.

How To Reproduce

This is what the gradle file looks like


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

android {
    compileSdk Integer.parseInt(ANDROID_BUILD_COMPILED_SDK_VERSION)

    defaultConfig {
        applicationId "com.app.name"
        minSdk Integer.parseInt(ANDROID_BUILD_MIN_SDK_VERSION)
        targetSdk Integer.parseInt(ANDROID_BUILD_TARGET_SDK_VERSION)
        versionCode project.hasProperty('BUILD_NUMBER') ? project['BUILD_NUMBER'].toInteger() : 14
        versionName "1.3.3"
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        debug {
            storeFile file(DEBUG_KEYSTORE_FILE)
            storePassword DEBUG_KEYSTORE_PASSWORD
            keyAlias DEBUG_KEYSTORE_KEY_ALIAS
            keyPassword DEBUG_KEYSTORE_KEY_PASSWORD
        }
        release {
            storeFile file(APPNAME_KEYSTORE_FILE)
            storePassword APPNAME_KEYSTORE_PASSWORD
            keyAlias APPNAME_KEYSTORE_KEY_ALIAS
            keyPassword APPNAME_KEYSTORE_KEY_PASSWORD
        }
    }

    buildTypes {
        debug {
            debuggable true
            minifyEnabled true
            shrinkResources true
            multiDexEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

            signingConfig signingConfigs.debug
        }
        release {
            debuggable false
            minifyEnabled true
            shrinkResources true
            multiDexEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

            signingConfig signingConfigs.release
        }
    }

    compileOptions {
        // Flag to enable support for the new language APIs
        coreLibraryDesugaringEnabled true
        // Sets Java compatibility to Java 8
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }

    lintOptions {
        disable "MissingClass"
    }

    buildFeatures {
        viewBinding true
    }
}

play {
    serviceAccountCredentials.set(file(GOOGLE_PLAY_API_KEY_FILE))
}

Versions

Tasks executed

gradlew -PANDROID_BUILD_COMPILED_SDK_VERSION=30 -PANDROID_BUILD_MIN_SDK_VERSION=21 -PANDROID_BUILD_TARGET_SDK_VERSION=30 -PDEBUG_KEYSTORE_FILE="C:/Users/USERNAME/Keys/Debug Key/debug.keystore" -PDEBUG_KEYSTORE_PASSWORD=android -PDEBUG_KEYSTORE_KEY_ALIAS=androiddebugkey -PDEBUG_KEYSTORE_KEY_PASSWORD=android -PAPPNAME_KEYSTORE_FILE="C:/Users/USERNAME/Keys/Release Key/keystore.jks" -PAPPNAME_KEYSTORE_PASSWORD=release -PAPPNAME_KEYSTORE_KEY_ALIAS=release -PAPPNAME_KEYSTORE_KEY_PASSWORD=release -PGOOGLE_PLAY_API_KEY="C:/Users/USERNAME/Keys/Google Play/google-play-api-key.json" -PBUILD_NUMBER=15 clean :app:publishFreeReleaseBundle

Expected behavior

Success

Additional context (if a crash, provide stack trace)

Add any other context about the problem here. If this bug is a crash, run the task with --stacktrace to get the full context.

SUPERCILEX commented 3 years ago

What does "not work" mean? By default it'll publish to the internal track, you need to specify production if you don't want that.

ArcherEmiya05 commented 3 years ago

What does "not work" mean? By default it'll publish to the internal track, you need to specify production if you don't want that.

After executing the above command in AS terminal what I get is in the title Task 'publishFreeReleaseBundle' not found in project ':app'.

SUPERCILEX commented 3 years ago

Use publishReleaseBundle.

ArcherEmiya05 commented 3 years ago

Use publishReleaseBundle.

Will try this one many thanks, may I also know what are the list of task command available with GPP because as I saw in many article they used publishFreeReleaseBundle or publishProReleaseBundle instead of just publishReleaseBundle and I do not know the difference when not specifying if free or pro version.

SUPERCILEX commented 3 years ago

That's if you have flavor dimensions (you don't). See https://github.com/Triple-T/gradle-play-publisher#task-organization

ArcherEmiya05 commented 3 years ago

That's if you have flavor dimensions (you don't). See https://github.com/Triple-T/gradle-play-publisher#task-organization

Oh I really missed that part, thank you so much!

Faisal-ali-shah commented 3 years ago

@SUPERCILEX i'm using id 'com.github.triplet.play' version '2.2.1' and trying to upload app bundle instead of apk by default and apk upload working fine. play { track = 'beta' defaultToAppBundles = true serviceAccountCredentials = file('k.json') }

but when I run ./gradlew publish

getting exception what am I missing you can please guide me ?

BUILD FAILED in 6s

SUPERCILEX commented 3 years ago

Please follow the readme. 2.2.1 is way too old, you should be on a 3.x.

ArcherEmiya05 commented 3 years ago

Use publishReleaseBundle.

Still not working as I am getting this instead


 * What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':app:publishReleaseBundle'.
   > com/android/build/api/artifact/ArtifactType$BUNDLE
SUPERCILEX commented 3 years ago

Right, you're using AGP 7.1, so you'll need GPP 3.5.0-agp7.0.

ArcherEmiya05 commented 3 years ago

It works, this will be very handy on a CI CD setup. Kudos!