alibaba / ARouter

💪 A framework for assisting in the renovation of Android componentization (帮助 Android App 进行组件化改造的路由框架)
Apache License 2.0
14.41k stars 2.59k forks source link

同时使用arouter 和 hilt报错 #1051

Open jack-alon opened 11 months ago

jack-alon commented 11 months ago

错误: ARouter::Compiler An exception is encountered, [These no module name, at 'build.gradle', like : android { defaultConfig { ... javaCompileOptions { annotationProcessorOptions { arguments = [AROUTER_MODULE_NAME: project.getName()] } } } } ] 1 个错误

FAILURE: Build failed with an exception.

wangmin666 commented 10 months ago

use kapt replace arguments: kapt { arguments { arg("AROUTER_MODULE_NAME", project.getName()) } }

mistermingming commented 7 months ago

use kapt replace arguments: kapt { arguments { arg("AROUTER_MODULE_NAME", project.getName()) } }

试了好像不行啊,有人试过了吗

blundell commented 6 months ago

@mistermingming pls show your build.gradle that declares kapt { arguments {

and what version of the plugin: com.google.dagger.hilt.android are you using? I could reproduce the error with 2.48.1, but it works ok with 2.44.2

wangmin666 commented 6 months ago

@blundell hilt version: 2.44,i have replaced all 'annotationProcessorOptions' with 'kapt'. I will try with verion 2.48.1 later.

wangmin666 commented 6 months ago

@mistermingming replaced all java annotations with kapt and build again ?

wangmin666 commented 5 months ago

@blundell @jack-alon I could reproduce with hilt 2.46, but it works 2.44. Have u fixed this?

blundell commented 5 months ago

No, we are also stuck on 2.44 for now (assuming that's the issue, still not 100% certain)

blundell commented 1 month ago

~I think I found the cause, in Hilt v2.45: https://github.com/google/dagger/issues/3546 /~ ~https://github.com/google/dagger/pull/3658~

~not figured out the solution yet :-)~

Made a simple reproduction project: https://github.com/blundell/ARouterHiltIssue

This is the least code needed to reproduce this issue.

It appears, whatever the change was, was introduced in Hilt 2.46

wangmin666 commented 1 month ago

@blundell Use hilt higher version 2.50,i have checked it. But u should do another hilt config, becaue higher hilt may by cover ohter's annotation.

confit like this hilt { enableExperimentalClasspathAggregation = true enableAggregatingTask = false }

blundell commented 1 month ago

@blundell Use hilt higher version 2.50,i have checked it. But u should do another hilt config, becaue higher hilt may by cover ohter's annotation.

Yes the reproducer project uses Hilt: 2.51.1 : https://github.com/blundell/ARouterHiltIssue/blob/main/gradle/libs.versions.toml#L5

config like this hilt { enableExperimentalClasspathAggregation = true enableAggregatingTask = false }

Thanks I've just tried that.

Using only:

    hilt {
        enableAggregatingTask = false
    }

the reproducer project build succeeds! 🎉 🙇‍♂️

wangmin666 commented 1 month ago

@blundell Good job!✈✈

superoidlau commented 1 month ago

@blundell Use hilt higher version 2.50,i have checked it. But u should do another hilt config, becaue higher hilt may by cover ohter's annotation.

confit like this

hilt { enableExperimentalClasspathAggregation = true enableAggregatingTask = false }

Thank you , this is the final solution.