将 Android Studio 更新到 3.5 后,每当构建项目时,我都会遇到以下警告。
Missing class: com.fasterxml.jackson.core.type.TypeReference
我的项目正在使用AndroidX。这是我的 build.gradle(应用程序)的要点 https://gist.github.com/Arkar009/4ae5a05ff3435636bc605fee1fbdb050 。谁能知道为什么会发生此错误或解决此错误的替代想法?提前致谢。
最佳答案
如果您非常确定以后在项目中包含 Jackson 时会记住这一行,那么这样做就可以了(将其添加到项目的 proguard-project.[txt|pro] 文件中):
-dontwarn com.fasterxml.jackson.core.type.TypeReference
该类以某种方式包含在 R8 中设置的缺失类中(我在 R8 的代码中没有走那么远),但是如果您在“不警告”的模式列表中获得该类,则可以跳过警告“规则(参见 com/android/tools/r8/R8.java):
List<ProguardConfigurationRule> synthesizedProguardRules = new ArrayList<>();
timing.begin("Strip unused code");
Set<DexType> classesToRetainInnerClassAttributeFor = null;
try {
Set<DexType> missingClasses = appView.appInfo().getMissingClasses();
missingClasses = filterMissingClasses(
missingClasses, options.getProguardConfiguration().getDontWarnPatterns());
if (!missingClasses.isEmpty()) {
missingClasses.forEach(
clazz -> {
options.reporter.warning(
new StringDiagnostic("Missing class: " + clazz.toSourceString()));
});
TBH,我也被这个警告困扰到进入 R8,希望它有帮助!
关于android-studio - 缺少类 : com. fastxml.jackson.core.type.TypeReference。 R8:警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57652944/