question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hilt plugin crash with android gradle plugin 7 beta04

See original GitHub issue

Versions:

Android Studio Arctic Fox Beta 4 Android tools gradle plugin 7.0.0-beta04 kotlin gradle plugin 1.5.10 dagger 2.37

Gradle build fails when applying hilt plugin to the module:

plugins {
    ...
    id("dagger.hilt.android.plugin")
    ...
}

Partial stacktrace

com/android/build/api/extension/AndroidComponentsExtension$DefaultImpls

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension$DefaultImpls
	at dagger.hilt.android.plugin.HiltGradlePlugin.configureBytecodeTransformASM(HiltGradlePlugin.kt:258)
	at dagger.hilt.android.plugin.HiltGradlePlugin.configureHilt(HiltGradlePlugin.kt:89)
	at dagger.hilt.android.plugin.HiltGradlePlugin.access$configureHilt(HiltGradlePlugin.kt:59)
	at dagger.hilt.android.plugin.HiltGradlePlugin$apply$1.execute(HiltGradlePlugin.kt:66)
	at dagger.hilt.android.plugin.HiltGradlePlugin$apply$1.execute(HiltGradlePlugin.kt:59)
	at org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1.execute(DefaultUserCodeApplicationContext.java:112)
	at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction$1.run(DefaultCollectionCallbackActionDecorator.java:95)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:74)

EDIT If anyone needs a quick fix without downgrading AS it compiles without errors on alpha using Android Studio Bumblebee Canary 2 and AGP 7.1.0-alpha02.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:82
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

35reactions
danysantiagocommented, Jun 17, 2021

The Android Gradle Plugin team is aware of the issue and a fix for this will be available in AGP 7 beta05.

13reactions
danysantiagocommented, Jun 23, 2021

Sorry all for the issue, AGP is expected to have a release sometime next week for 7.0-beta, if all goes well. Meanwhile using 7.1-alpha02 should work.

And just for context, this is related to Hilt’s bytecode transform which uses AGP’s new ASM pipeline starting in 4.2 which is way more efficient and correct than the ‘previous’ version. The APIs for the ASM transform are planned to become stable soon in 7.0 so hopefully, in the near future this should be less of an issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Studio 2021.2.1 Closed Issues
Released together with: Android Gradle Plugin 7.2.0-beta04. Fixed Issues. Android Gradle Plugin ...
Read more >
Error in gradle when implement hilt library in android
Stop Gradle build processes (requires restart) Your project may be using a third-party plugin which is not compatible with the other plugins in ......
Read more >
Release Notes - Play services - Google Developers
The latest update to the OSS licenses Gradle plugin includes fixes for the following ... Firebase Android BoM (Bill of Materials); Firebase Crashlytics....
Read more >
[오류수정] Unable to find method - My Knowledge Warehouse
프로젝트의 Android Gradle Plugin Version과 Gradle Version을 ... Gradle crashes with: Hilt + AGP 4.2.0-beta04 · Issue #2337 · google/dagger.
Read more >
John O'Reilly on Twitter: "Also, just fyi that this is using ...
Versions: Android Studio Arctic Fox Beta 4 Android tools gradle plugin 7.0.0-beta04 kotlin gradle plugin 1.5.10 dagger 2.37 Gradle build fails ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found