l***@163.com
l***@163.com
  • 发布:2020-03-15 18:54
  • 更新:2020-11-10 09:03
  • 阅读:1080

第三方插件支持注解吗?

分类:uni-app

问题

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':javaPreCompileRelease'.

    Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.

  • dbflow-processor-4.2.4.jar (com.github.Raizlabs.DBFlow:dbflow-processor:4.2.4)

  • lombok-1.18.8.jar (org.projectlombok:lombok:1.18.8)
    Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future.
    See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.

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

相关配置 package.json

            "com.android.support:support-v4:28.0.0",  
            "com.android.support:appcompat-v7:28.0.0",  
           "com.android.support:recyclerview-v7:28.0.0",  
           "com.facebook.fresco:fresco:1.13.0",  
            "com.facebook.fresco:animated-gif:1.13.0",  
           "com.github.bumptech.glide:glide:4.9.0",  
           "com.alibaba:fastjson:1.1.46.android",  
           "com.github.nkzawa:socket.io-client:0.6.0",  
           "com.github.Raizlabs.DBFlow:dbflow-processor:4.2.4",  
           "com.github.Raizlabs.DBFlow:dbflow-core:4.2.4",  
           "com.github.Raizlabs.DBFlow:dbflow:4.2.4",  
           "org.projectlombok:lombok:1.18.8"
2020-03-15 18:54 负责人:无 分享
已邀请:
l***@163.com

l***@163.com (作者) - 斗麦科技

这种问题怎么解决

  • 7***@qq.com

    请问下,你的这个问题咋解决的呀?

    2020-11-06 17:22

hechenghuan

hechenghuan

可以参考文档里对package.json字段的描述,以下摘录自原文


HBuilderX2.3.8+开始添加更灵活配置,支持源码写dependencies内容

dependencies中的值支持json对象,如下:

"dependencies": [//内容支持字符串或json格式,支持混写  
    {  
        "id": "com.android.support.test.espresso:espresso-contrib",  //可选,String类型,依赖库标识  
        "source": "implementation('com.android.support.test.espresso:espresso-contrib:2.2.2', {\r\nexclude group: 'com.android.support', module: 'support-v4'\r\n})"   //必选,String类型,依赖库源码  
    }  
]  

JSON格式支持以下字段:

id 依赖库的标识,使用多个uni原生插件时,都依赖相同的库时会根据此标识去重,避免产生冲突。 不配置此值则不做去重处理。
source 依赖库源码,直接将此内容配置到云端打包工程的build.gradle文件的dependencies中。 只支持写引用公共仓储上的库。 如上示例,将会在云端打包时将以下内容添加到build.gradle文件的dependencies中:

implementation('com.android.support.test.espresso:espresso-contrib:2.2.2', {  
    exclude group: 'com.android.support', module: 'support-v4'  
})  

注意:换行符号需要转义为\r\n。


***最后,解决方案:
根据以上的文档,再结合项目里的情况
针对包含注解的lib包,以dagger为例,在package.json中加入以下代码即可
{"source":"implementation 'com.google.dagger:dagger:2.8'"},
{"source":"annotationProcessor 'com.google.dagger:dagger-compiler:2.8'"}

该问题目前已经被锁定, 无法添加新回复