Closed WebTiger89 closed 3 months ago
The underlying issue seems to be that we want to package the BuildConfig
, before it's even created. Let's have a closer look and check if maybe even should exclude the BuildConfig
class.
hey @WebTiger89 the issue has been addressed in the version 4.6.0, which just has been published. Please give it a try and let us know. Thank you!
Unfortunately the issue persists. I have updated the version to 4.7.1. When enabling confiuration cache in gradle.properties file: org.gradle.unsafe.configuration-cache=true
I get following error:
- What went wrong: Configuration cache state could not be cached: field
provider
oforg.gradle.configurationcache.serialization.codecs.ProviderBackedFileCollectionSpec
bean found in field__sourceDirs__
of task:myapp:generateSentryBundleIdMinApi29Debug
of typeio.sentry.android.gradle.sourcecontext.GenerateBundleIdTask
: error writing value of type 'org.gradle.api.internal.provider.BiProvider' Querying the mapped value of property(org.gradle.api.file.Directory, property(org.gradle.api.file.Directory, property(org.gradle.api.file.Directory, map(org.gradle.api.file.Directory flatmap(provider(task 'generateMinApi29DebugBuildConfig', class com.android.build.gradle.tasks.GenerateBuildConfig)) check-type())))) before task ':myapp:generateMinApi29DebugBuildConfig' has completed is not supported
Using .\gradlew myapp:assembleMinApi29Debug --no-configuration-cache works
@romtsn Can you reopen the issue please
@WebTiger89 ok, thanks for letting us know. In this case I'll have to ask to provide a reproducible sample - would you be able to do so? Otherwise, I'm afraid we won't be able to fix it.
@WebTiger89 any chance you can provide a sample here?
@romtsn I have found a solution: Since AGP 8.0 BuildConfig generation is disabled by default, see https://developer.android.com/build/releases/past-releases/agp-8-0-0-release-notes, BuildConfig generation must be enabled explicitly per module.
I have enbaled generation
buildFeatures.buildConfig = true
(build.gradle.kts)
for my android app module which is the cause for failing when sentry-android-gradle-plugin is used in combination with
org.gradle.unsafe.configuration-cache=true
(gradle.properties)
It works if I set buildFeatures.buildConfig = false
, but it also works if I add android.enableBuildConfigAsBytecode=true
to gradle.properties file, found here https://medium.com/androiddevelopers/5-ways-to-prepare-your-app-build-for-android-studio-flamingo-release-da34616bb946
Glad that you found it and thanks for sharing the details!
I'd guess to reproduce this, we'd have to test on AGP 8.+ and enable buildFeatures.buildConfig = true
, correct?
Yeah buildFeatures.buildConfig = true
and org.gradle.unsafe.configuration-cache=true
(gradle.properties)
okay, thanks, somehow I wasn't able to reproduce it myself, but one of our tests was able to catch this, so I'll look into it!
@WebTiger89 version 4.9.0
has been shipped, please give it a try and let us know if the issue is still not fixed. thank you!
Gradle Version
8.7
AGP Version
8.4.0-beta01
Code Minifier/Optimizer
None
Version
4.4.0
Sentry SDK Version
7.6.0
Steps to Reproduce
Enable gradle configuration cache
Expected Result
Build succeed instead of failing
Actual Result
When trying to build my app module via terminal the build fails with error:
Using --no-configuration-cache works.
See issue https://github.com/getsentry/sentry-android-gradle-plugin/issues/554