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.
Include the play closure to the build.gradle file and sync
It fails when syncing after modifying the play closure
I would expect the sync to be successful
Hmmm, looks like I need to update the docs for this. Someone else just asked the same thing: https://github.com/Triple-T/gradle-play-publisher/issues/827#issuecomment-725673682
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
Invalidate caches and restart? 馃槤 If it works in Gradle, that's an IntelliJ problem and not related to this project.
It doesn't solve it unfortunately
But all I can say so far is that it just wrong, but it does work 馃憤
Thanks for your help and your great work
Bummer, hopefully an update to Studio or IntelliJ will fix it.
Note to self: also add comment about user fraction needing a d in groovy.
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)
......
}
In gradle+androidstudio, i had to use the fully qualified "com.github.triplet.gradle.androidpublisher.ReleaseStatus.DRAFT" like you posted here. @SUPERCILEX Since import statement wasn't working for me, it would be helpful to add to the readme as part of migration to 3+
Even with the fully qualified name of ReleaseStatus.DRAFT as @btseytlinTCP suggested, I'm still getting an error:
Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'com' for extension 'play' of type com.github.triplet.gradle.play.PlayPublisherExtension.
When I remove releaseStatus property setter, there's no issue. I tried to invalidate caches and restart Android Studio, tried to run gradle build --no-build-cache, nothing works. Any idea how to fix this?
@micer Perhaps your import is on the wrong fields? Example:
play {
releaseStatus.set(com.github.triplet.gradle.androidpublisher.ReleaseStatus.COMPLETED)
resolutionStrategy.set(com.github.triplet.gradle.androidpublisher.ResolutionStrategy.AUTO)
}
@btseytlinTCP nope, seems to be correct:
apply plugin: 'com.github.triplet.play'
android {
playConfigs {
europeUkRelease {
enabled.set(true)
}
}
}
play {
enabled.set(false)
serviceAccountCredentials.set(file("${rootDir}/../../android.json"))
track.set("production")
releaseStatus.set(com.github.triplet.gradle.androidpublisher.ReleaseStatus.DRAFT)
}
I have this in separated gradle file and added to module's build.gradle with apply from: "${rootDir}/gradle/google_play_publisher.gradle", but that shouldn't be a problem.
i'd try
plugins {
id("com.github.triplet.play") version("3.2.0")
}
Yeah, for whatever reason I don't think Gradle lets you use imports outside of the build.gradle file.
Yes, moving all to module's build.gradle works! 馃く Thanks guys!
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")
}
Most helpful comment
Right I forgot, I also use the plugin block
If I simply add the line
import com.github.triplet.gradle.androidpublisher.ReleaseStatusin the file it does sync and build, though the line has theReleaseStatuscoloured in red and, despite the file syncing and allowing me to perform./gradlewcommands, it still shows as faulty with a wiggly red line under its filename