airbnb / okreplay

📼 Record and replay OkHttp network interaction in your tests.
Apache License 2.0
781 stars 71 forks source link

Cannot query the value of property 'applicationId' #113

Open eric-sofisoftwarellc opened 2 years ago

eric-sofisoftwarellc commented 2 years ago
Caused by: java.lang.IllegalStateException: Cannot query the value of property 'applicationId' because configuration of project ':app' has not completed yet.
        at org.gradle.api.internal.provider.AbstractProperty$NonFinalizedValue.maybeFinalizeOnRead(AbstractProperty.java:368)
        at org.gradle.api.internal.provider.AbstractProperty.beforeRead(AbstractProperty.java:229)
        at org.gradle.api.internal.provider.AbstractProperty.calculateOwnValue(AbstractProperty.java:126)
        at org.gradle.api.internal.provider.AbstractMinimalProvider.get(AbstractMinimalProvider.java:84)
        at com.android.build.gradle.internal.api.BaseVariantImpl.getApplicationId(BaseVariantImpl.java:245)
        at com.android.build.gradle.internal.api.TestVariantImpl_Decorated.getApplicationId(Unknown Source)
        at okreplay.OkReplayPlugin$Companion.testApplicationId(OkReplayPlugin.kt:102)
        at okreplay.OkReplayPlugin$Companion.access$testApplicationId(OkReplayPlugin.kt:88)
        at okreplay.OkReplayPlugin$applyPlugin$1$1.execute(OkReplayPlugin.kt:68)
        at okreplay.OkReplayPlugin$applyPlugin$1$1.execute(OkReplayPlugin.kt:14)
        at org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1.execute(DefaultUserCodeApplicationContext.java:123)
...

All I did was add classpath 'com.airbnb.okreplay:gradle-plugin:1.5.0' and apply plugin: 'okreplay' to build.gradle. AS 2020.3.1 patch 3, com.android.tools.build:gradle:7.0.3.

KatieBarnett commented 2 years ago

I got this error as well, upgrading to AGP to 7.1.0-alpha05 fixed it (although I have other issues with OkReplay not working)

hashsalt0 commented 1 year ago

I had this issue when I was using com.airbnb.okreplay:gradle-plugin:1.5.0 using com.airbnb.okreplay:gradle-plugin:1.6.0 seems to have fixed the issue.