Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not get unknown property 'ReleaseStatus' for extension 'play' #885

Closed
kioli opened this issue Nov 13, 2020 · 16 comments
Closed

Could not get unknown property 'ReleaseStatus' for extension 'play' #885

kioli opened this issue Nov 13, 2020 · 16 comments
Labels
docs Indicates issues where the documentation should be changed or enhanced feature:other Involves a feature that doesn't fit in existing categories
Milestone

Comments

@kioli
Copy link

kioli commented Nov 13, 2020

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

@kioli kioli added the bug Indicates an unexpected problem or unintended behavior label Nov 13, 2020
@SUPERCILEX
Copy link
Collaborator

Hmmm, looks like I need to update the docs for this. Someone else just asked the same thing: #827 (comment)

@SUPERCILEX SUPERCILEX added docs Indicates issues where the documentation should be changed or enhanced feature:other Involves a feature that doesn't fit in existing categories and removed bug Indicates an unexpected problem or unintended behavior labels Nov 13, 2020
@kioli
Copy link
Author

kioli commented Nov 13, 2020

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

@SUPERCILEX
Copy link
Collaborator

Invalidate caches and restart? 😝 If it works in Gradle, that's an IntelliJ problem and not related to this project.

@kioli
Copy link
Author

kioli commented Nov 13, 2020

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

@SUPERCILEX
Copy link
Collaborator

Bummer, hopefully an update to Studio or IntelliJ will fix it.

@SUPERCILEX
Copy link
Collaborator

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

@SUPERCILEX SUPERCILEX added this to the 3.1.0 milestone Dec 2, 2020
@underwindfall
Copy link

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) 
        ......
    }

@btseytlinTCP
Copy link

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+

@micer
Copy link

micer commented Jan 21, 2021

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?

@btseytlinTCP
Copy link

@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)
}

@micer
Copy link

micer commented Jan 21, 2021

@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.

@btseytlinTCP
Copy link

i'd try

  1. moving to plugins{} instead of apply plugin:
plugins {
    id("com.github.triplet.play") version("3.2.0")
}
  1. Try sanity checking by moving it into the module's build.gradle file to circumvent the apply from thing you're doing and isolate the issue further

@SUPERCILEX
Copy link
Collaborator

Yeah, for whatever reason I don't think Gradle lets you use imports outside of the build.gradle file.

@micer
Copy link

micer commented Jan 22, 2021

Yes, moving all to module's build.gradle works! 🤯 Thanks guys!

@xsveda
Copy link

xsveda commented Mar 16, 2021

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")
}

@SUPERCILEX
Copy link
Collaborator

See #1039 for a proper fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Indicates issues where the documentation should be changed or enhanced feature:other Involves a feature that doesn't fit in existing categories
Projects
None yet
Development

No branches or pull requests

6 participants