Dagger: Hilt: Native function causing build fail: codeAttr must not be null

Created on 25 Aug 2020  路  7Comments  路  Source: google/dagger

Similar to #1955 having a native function inside a class marked with @AndroidEntryPoint causes the build to fail with the same error message mentioned in that issue.

Execution failed for task ':app:transformClassesWithAndroidEntryPointTransformForDebug'.
> codeAttr must not be null
P2 hilt bug

Most helpful comment

I can confirm that the error no longer occurs for me with version 2.29-alpha.

All 7 comments

This is already fixed by https://github.com/google/dagger/commit/2099bade9a2d9ba0fd9fc9b8a31006ed7b13cf41, the next released version of Hilt will contain this fix. As workaround for now, you can move your native method from the @AndroidEntryPoint-annotated class.

This is still reproductible in 2.29-alpha.
@AndroidEntryPoint class MyTestActivity : AppCompatActivity() { .... private external fun stringFromJNI(): String .... }

I can confirm that the error no longer occurs for me with version 2.29-alpha.

Also in 2.29.1-alpha is reproductible.
Execution failed for task ':classifier:transformClassesWithAndroidEntryPointTransformForDebug' > codeAttr must not be null

@catalin-florescu, I can't reproduce this issue with 2.29.1, can you confirm you are updating the Hilt Gradle Plugin (classpath 'com.google.dagger:hilt-android-gradle-plugin:2.29.1-alpha')?

@danysantiago Well, i forgot to update Gradle plugin. When is available new version, please mention it on Latest release. Thanks.

@catalin-florescu, Dagger always releases all of its artifacts together.

A good best practice to avoid forgetting to update a particular dependency is to store the version in Gradle's property extensions and reference all of your dependencies like: "com.google.dagger:hilt-android:${daggerVersion}-alpha"

Edit: Also, just added a reference to #2065 in the 2.29.1 release notes, since we originally only referenced #1955.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sagarwaghmare07 picture sagarwaghmare07  路  3Comments

feinstein picture feinstein  路  3Comments

matpag picture matpag  路  3Comments

HiroyukTamura picture HiroyukTamura  路  3Comments

gc986 picture gc986  路  4Comments