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

Migrate away from removed AGP APIs #2618

Closed
liutikas opened this issue May 13, 2021 · 0 comments
Closed

Migrate away from removed AGP APIs #2618

liutikas opened this issue May 13, 2021 · 0 comments

Comments

@liutikas
Copy link

HiltGradlePlugin uses apis that have been removed in Android Gradle Plugin 7.0.0-*

Specifically, androidComponents.androidTests

Right now with tip of tree AGP (and thus next release), Gradle crashes with:

* Exception is:
java.lang.NoSuchMethodError: 'void com.android.build.api.extension.AndroidComponentsExtension$DefaultImpls.androidTests$default(com.android.build.api.extension.AndroidComponentsExtension, com.android.build.api.extension.VariantSelector, kotlin.jvm.functions.Function1, int, java.lang.Object)'
	at dagger.hilt.android.plugin.HiltGradlePlugin.configureTransformASM(HiltGradlePlugin.kt:239)
	at dagger.hilt.android.plugin.HiltGradlePlugin.configureHilt(HiltGradlePlugin.kt:79)
	at dagger.hilt.android.plugin.HiltGradlePlugin.access$configureHilt(HiltGradlePlugin.kt:50)
	at dagger.hilt.android.plugin.HiltGradlePlugin$apply$1.execute(HiltGradlePlugin.kt:57)
	at dagger.hilt.android.plugin.HiltGradlePlugin$apply$1.execute(HiltGradlePlugin.kt:50)
	at dagger.hilt.android.plugin.HiltGradlePlugin.apply(HiltGradlePlugin.kt:55)
	at dagger.hilt.android.plugin.HiltGradlePlugin.apply(HiltGradlePlugin.kt:50)
@danysantiago danysantiago self-assigned this May 13, 2021
copybara-service bot pushed a commit that referenced this issue May 14, 2021
The AndroidComponentsExtension's methods androidTests() and unitTests() are removed from AGP 7.0, migrate away from their usages by using the new variant.androidTest and variant.unitTest methods. To support backward compatibility for users with AGP 4.2 reflect into the old and removed methods.

Furthermore to protect against unstable API changes this change adds a postsubmit Github Action to compile the Hilt Gradle plugin against the latest released Android Gradle Plugin. This combined with turning ON all warnings as error will help such that if an API is marked as @deprecated, then the build will fail. Due to all warnings as error being ON a few additional suppressed are added, all previous ones are commented and some trivial API usages from AGP were removed. In essence only APIs from the 'com.android.build.api' package are safe to use.

Fixes: #2618
RELNOTES=Fix compatibility issue with the Hilt Gradle Plugin and Android Gradle Plugin 7.0
PiperOrigin-RevId: 373728621
copybara-service bot pushed a commit that referenced this issue May 14, 2021
The AndroidComponentsExtension's methods androidTests() and unitTests() are removed from AGP 7.0, migrate away from their usages by using the new variant.androidTest and variant.unitTest methods. To support backward compatibility for users with AGP 4.2 reflect into the old and removed methods.

Furthermore to protect against unstable API changes this change adds a postsubmit Github Action to compile the Hilt Gradle plugin against the latest released Android Gradle Plugin. This combined with turning ON all warnings as error will help such that if an API is marked as @deprecated, then the build will fail. Due to all warnings as error being ON a few additional suppressed are added, all previous ones are commented and some trivial API usages from AGP were removed. In essence only APIs from the 'com.android.build.api' package are safe to use.

Fixes: #2618
RELNOTES=Fix compatibility issue with the Hilt Gradle Plugin and Android Gradle Plugin 7.0
PiperOrigin-RevId: 373728621
copybara-service bot pushed a commit that referenced this issue May 14, 2021
The AndroidComponentsExtension's methods androidTests() and unitTests() are removed from AGP 7.0, migrate away from their usages by using the new variant.androidTest and variant.unitTest methods. To support backward compatibility for users with AGP 4.2 reflect into the old and removed methods.

Furthermore to protect against unstable API changes this change adds a postsubmit Github Action to compile the Hilt Gradle plugin against the latest released Android Gradle Plugin. This combined with turning ON all warnings as error will help such that if an API is marked as @deprecated, then the build will fail. Due to all warnings as error being ON a few additional suppressed are added, all previous ones are commented and some trivial API usages from AGP were removed. In essence only APIs from the 'com.android.build.api' package are safe to use.

Fixes: #2618
RELNOTES=Fix compatibility issue with the Hilt Gradle Plugin and Android Gradle Plugin 7.0
PiperOrigin-RevId: 373728621
copybara-service bot pushed a commit that referenced this issue May 14, 2021
The AndroidComponentsExtension's methods androidTests() and unitTests() are removed from AGP 7.0, migrate away from their usages by using the new variant.androidTest and variant.unitTest methods. To support backward compatibility for users with AGP 4.2 reflect into the old and removed methods.

Furthermore to protect against unstable API changes this change adds a postsubmit Github Action to compile the Hilt Gradle plugin against the latest released Android Gradle Plugin. This combined with turning ON all warnings as error will help such that if an API is marked as @deprecated, then the build will fail. Due to all warnings as error being ON a few additional suppressed are added, all previous ones are commented and some trivial API usages from AGP were removed. In essence only APIs from the 'com.android.build.api' package are safe to use.

Fixes: #2618
RELNOTES=Fix compatibility issue with the Hilt Gradle Plugin and Android Gradle Plugin 7.0
PiperOrigin-RevId: 373728621
copybara-service bot pushed a commit that referenced this issue May 14, 2021
The AndroidComponentsExtension's methods androidTests() and unitTests() are removed from AGP 7.0, migrate away from their usages by using the new variant.androidTest and variant.unitTest methods. To support backward compatibility for users with AGP 4.2 reflect into the old and removed methods.

Furthermore to protect against unstable API changes this change adds a postsubmit Github Action to compile the Hilt Gradle plugin against the latest released Android Gradle Plugin. This combined with turning ON all warnings as error will help such that if an API is marked as @deprecated, then the build will fail. Due to all warnings as error being ON a few additional suppressed are added, all previous ones are commented and some trivial API usages from AGP were removed. In essence only APIs from the 'com.android.build.api' package are safe to use.

Fixes: #2618
RELNOTES=Fix compatibility issue with the Hilt Gradle Plugin and Android Gradle Plugin 7.0
PiperOrigin-RevId: 373728621
copybara-service bot pushed a commit that referenced this issue May 17, 2021
The AndroidComponentsExtension's methods androidTests() and unitTests() are removed from AGP 7.0, migrate away from their usages by using the new variant.androidTest and variant.unitTest methods. To support backward compatibility for users with AGP 4.2 reflect into the old and removed methods.

Furthermore to protect against unstable API changes this change adds a postsubmit Github Action to compile the Hilt Gradle plugin against the latest released Android Gradle Plugin. This combined with turning ON all warnings as error will help such that if an API is marked as @deprecated, then the build will fail. Due to all warnings as error being ON a few additional suppressed are added, all previous ones are commented and some trivial API usages from AGP were removed. In essence only APIs from the 'com.android.build.api' package are safe to use.

Fixes: #2618
RELNOTES=Fix compatibility issue with the Hilt Gradle Plugin and Android Gradle Plugin 7.0
PiperOrigin-RevId: 373728621
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants