gradle-play-publisher: Could not get unknown property 'ReleaseStatus' for extension 'play'

Describe the bug

I’ve recently migrated from 2.3.0 to 3.0.0 and I changed my build.gradle file accordingly going from this

play {
    track = "beta"
    releaseStatus = "inProgress"
    userFraction = 1
    serviceAccountCredentials = file("credentials.json")
}

to this

play {
    track.set("beta")
    userFraction.set(new Double(1))
    releaseStatus.set(ReleaseStatus.IN_PROGRESS)
    serviceAccountCredentials.set(file("credentials.json"))
}

But when I try to build my app I am presented with the following error

Could not get unknown property 'ReleaseStatus' for extension 'play' of type com.github.triplet.gradle.play.PlayPublisherExtension.

How To Reproduce

Include the play closure to the build.gradle file and sync

Versions

  • Gradle Play Publisher: 3.0.0
  • Gradle Wrapper: 6.5-all
  • Android Gradle Plugin: 4.1.1

Tasks executed

It fails when syncing after modifying the play closure

Expected behavior

I would expect the sync to be successful

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 16

Commits related to this issue

Most upvoted comments

I know this issue has been closed. But about the red lint was raised here , properly could be resovled by something like this

    play {
        ......
        //releaseStatus is the type of release, i.e. ReleaseStatus.[COMPLETED/DRAFT/HALTED/IN_PROGRESS]
        releaseStatus.set(com.github.triplet.gradle.androidpublisher.ReleaseStatus.DRAFT) 
        ......
    }

Right I forgot, I also use the plugin block

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-android-extensions'
    id 'kotlin-kapt'
    id 'com.google.firebase.appdistribution'
    id 'com.google.gms.google-services'
    id 'com.github.triplet.play'
}

If I simply add the line import com.github.triplet.gradle.androidpublisher.ReleaseStatus in the file it does sync and build, though the line has the ReleaseStatus coloured in red and, despite the file syncing and allowing me to perform ./gradlew commands, it still shows as faulty with a wiggly red line under its filename

For anyone having the same issue and using Triple-T plugin in buildSrc, this might help you.

We put the plugin on classpath in buildSrc/build.gradle.kts like this:

dependencies {
    implementation("com.github.triplet.gradle:play-publisher:3.3.0-agp4.2")
}

To have ReleaseStatus constants available you need to add aditional android-publisher module on classpath in buildSrc/build.gradle.kts:

dependencies {
    implementation("com.github.triplet.gradle:play-publisher:3.3.0-agp4.2")
    implementation("com.github.triplet.gradle:android-publisher:3.3.0-agp4.2")
}

Note to self: also add comment about user fraction needing a d in groovy.