缺少 class:com.fasterxml.jackson.core.type.TypeReference。 R8:Warning
Missing class: com.fasterxml.jackson.core.type.TypeReference. R8:Warning
我将 Android Studio 更新到 3.5 后,每当我构建我的项目时都会面临以下警告。
Missing class: com.fasterxml.jackson.core.type.TypeReference
我的项目正在使用 AndroidX。这是我的 build.gradle(app) 的要点
https://gist.github.com/Arkar009/4ae5a05ff3435636bc605fee1fbdb050。谁能知道为什么会发生此错误或解决此错误的其他想法?提前致谢。
如果您非常确定在稍后将 Jackson 包含在您的项目中时您会记住这一行,那么这样做就可以了(将其添加到您项目的 proguard-project.[txt|pro] 文件中):
-dontwarn com.fasterxml.jackson.core.type.TypeReference
class 以某种方式包含在 R8 中丢失的 classes Set 中(我在 R8 的代码中没有走那么远),但如果你得到 class 则可以跳过警告 class 在 "Don't Warn" 规则的模式列表中(参见 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 更新到 3.5 后,每当我构建我的项目时都会面临以下警告。
Missing class: com.fasterxml.jackson.core.type.TypeReference
我的项目正在使用 AndroidX。这是我的 build.gradle(app) 的要点 https://gist.github.com/Arkar009/4ae5a05ff3435636bc605fee1fbdb050。谁能知道为什么会发生此错误或解决此错误的其他想法?提前致谢。
如果您非常确定在稍后将 Jackson 包含在您的项目中时您会记住这一行,那么这样做就可以了(将其添加到您项目的 proguard-project.[txt|pro] 文件中):
-dontwarn com.fasterxml.jackson.core.type.TypeReference
class 以某种方式包含在 R8 中丢失的 classes Set 中(我在 R8 的代码中没有走那么远),但如果你得到 class 则可以跳过警告 class 在 "Don't Warn" 规则的模式列表中(参见 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,希望对您有所帮助!