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

Build failure: Cannot set the value of extension 'play' property 'releaseStatus' of type com.github.triplet.gradle.androidpublisher.ReleaseStatus using an instance of type java.lang.String #827

Closed neoxcorp closed 4 years ago

neoxcorp commented 4 years ago

build.gradle - project

repositories {
    google()
    jcenter()
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

dependencies {
    classpath "com.android.tools.build:gradle:${build_gradle_version}"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath "com.google.gms:google-services:$google_services_version"
    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_version"
    classpath "com.github.triplet.gradle:play-publisher:3.0.0-SNAPSHOT"
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

build.gradle - app

play {
    serviceAccountCredentials = file("../publish/api-first.json")
    track = 'internal'
    defaultToAppBundles = true
    enabled = false
    releaseStatus = 'draft'
}

When I try to build: `A problem occurred evaluating project ':app'.

Cannot set the value of extension 'play' property 'releaseStatus' of type com.github.triplet.gradle.androidpublisher.ReleaseStatus using an instance of type java.lang.String.`

How to set 'releaseStatus' ?

SUPERCILEX commented 4 years ago

You'll need to use ReleaseStatus.DRAFT: https://github.com/Triple-T/gradle-play-publisher/blob/304b0fecba33e4457ad17e0703c4d9d638203793/play/plugin/src/test/kotlin/com/github/triplet/gradle/play/PlayPublisherPluginIntegrationTest.kt#L80-L100

Does that work without imports? Otherwise, you'll need to import com.github.triplet.gradle.androidpublisher.ReleaseStatus.

neoxcorp commented 4 years ago

It works. Thanks.

cosic commented 4 years ago

@SUPERCILEX Hi! After upgrade on com.github.triplet.gradle:play-publisher:3.0.0 and AGP v4.1.0 I got the error:

FAILURE: Build failed with an exception.

Where: Script '/home/.../app.gradle' line: 57

What went wrong: A problem occurred evaluating script. Could not get unknown property 'ReleaseStatus' for extension 'play' of type >com.github.triplet.gradle.play.PlayPublisherExtension.

Gradle build script:

apply plugin: 'com.github.triplet.play'

play {
        serviceAccountCredentials.set(file("$rootDir/credentials/google-play-service-account-key.json"))
        defaultToAppBundles.set(true)
        track.set("production")
        userFraction.set(0.01d)
        releaseStatus.set(ReleaseStatus.IN_PROGRESS) // <-- line 57 here
}
SUPERCILEX commented 4 years ago

If you don't use the plugins block, I think you have to import that class:

import com.github.triplet.gradle.androidpublisher.ReleaseStatus

apply plugin: 'com.github.triplet.play'

...
cosic commented 4 years ago

@SUPERCILEX Thx for yout so quickly reply. Yeah, I've already tried to do that but got the error

Where: Script '/home/.../app.gradle' line: 5

What went wrong: Could not compile script '/home/.../app.gradle'. startup failed: script '/home/.../app.gradle': 5: unable to resolve class com.github.triplet.gradle.androidpublisher.ReleaseStatus @ line 5, column 1. import com.github.triplet.gradle.androidpublisher.ReleaseStatus ^

1 error

SUPERCILEX commented 4 years ago

Oh, I guess you have to put it below the apply plugin?

cosic commented 4 years ago

It's strange but seems build with --no-build-cache helped for me. It works with both import ... positions. Thank you for your help!