有一次刚拉下来代码,发现NestedScrollView标红导致整个项目使用引用的时候都是标红,,但是可以编译通过和运行就像这样:
试了许多方法:
clean项目、同步项目、Invalidate Caches/Restart甚至删除了一次.gradel,都没用作用
我的同事和我同时拉的代码啥也没改倒是没有问题,经过对比发现在External LibraLibrary中,NestedScrollView所在的jar包androidx.core:core:1.3.2@arr这个包下没有java代码只有资源文件和MTF,然后通过
找到目录:
找到这个jar包后解压发现有java代码并没有丢失,所以通过下面这句引导一下就可以了
这段代码写到整个项目的build.gradle中
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core') {
details.useVersion "1.3.2" //这个版本可以变,你可以根据你同事的版本修改
}
}
}
}
同步之后代码就不标红了,我删除了上面的代码再次同步后发现又没问题了,感觉非常奇怪记录一下