3rd-party Gradle plug-ins may be the cause 解决方案

转载请注明出处:https://blog.csdn.net/u011038298/article/details/81566085

今天决定把glide3.7升级至glide4.7.1

glide-GitHub地址 :https://github.com/bumptech/glide

项目使用kotlin语法,于是开始升级glide

先配置app/build.gradle文件

apply plugin: 'kotlin-kapt'

dependencies {

implementation 'com.github.bumptech.glide:glide:4.7.1'

kapt 'com.github.bumptech.glide:compiler:4.7.1'

}

扫描二维码关注公众号,回复: 3614426 查看本文章

然后在包名的目录下新增一个类:

public final class GlideModuleConfig extends AppGlideModule {}

接着同步build.gradle,原本以为大功告成。

结果,接着就抛出了一个警告信息:

Folder E:\AndroidStudioProjects\AndroidGit\android\app\build\generated\source\kaptKotlin\debug
Folder E:\AndroidStudioProjects\AndroidGit\android\app\build\generated\source\kaptKotlin\release
3rd-party Gradle plug-ins may be the cause

有人说是因为用了 apply plugin: 'kotlin-kapt' ,所以要删除 instant Appprovision;

也有人说添加代码到app/build.gradle 底部

    kapt {
        generateStubs = true
        mapDiagnosticLocations = true
    }

在都试过的情况下,发现还是没有解决这个问题。于是决定这么干:

glide使用java代码依赖,然后kotlin调用java代码:

先删掉 apply plugin: 'kotlin-kapt'

接着重新依赖:

dependencies {

implementation 'com.github.bumptech.glide:glide:4.7.1'

annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'

implementation ("com.github.bumptech.glide:glide:4.7.1@aar")  { transitive = true }

}

接着同步build.gradle,完美解决!

猜你喜欢

转载自blog.csdn.net/u011038298/article/details/81566085