JailedBird / ArouterGradlePlugin

Arouter auto register plugin for AGP7.4+ & AGP8
Apache License 2.0
43 stars 7 forks source link

ARouter + Hilt >= 2.46 build failure #11

Closed blundell closed 4 months ago

blundell commented 4 months ago

I am not sure if this is a problem with the ArouterGradlePlugin or a problem with Arouter itself. So I apologise if I am asking in the wrong place :-)

I have made a reproduction repo that shows the problem:

https://github.com/blundell/ARouterHiltIssue/tree/main

:app:hiltJavaCompileDebug FAILED    
error: 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 error

This happens when com.google.dagger.hilt.android gradle plugin version is >= 2.46.

But the build will build successfully if hilt plugin is <= 2.45.

Any ideas please🙏

JailedBird commented 4 months ago

1: The issue occur in arouter-compiler Your arouter-compiler is : arouter-compiler = { module = "com.github.jadepeakpoet.ARouter:arouter-compiler", version.ref = "arouter" } the jadepeakpoet's Arouter repo is https://github.com/jadepeakpoet/ARouter 2: in jadepeakpoet/ARouter compiler, thie problem occur in here, check your AROUTER_MODULE_NAME config

image

blundell commented 4 months ago

It seems even with correct config (and correct AROUTER_MODULE_NAME) certain setup's fail to find the annotation processor arguments. (Also raised here: https://github.com/alibaba/ARouter/issues/1051)

JailedBird commented 4 months ago

Can i close this issue? By the way, if you want use ksp to accelerate your build speed, perhaps you can try this ArouterKspCompiler

blundell commented 4 months ago

yeah no problem, thanks!