React native Android依赖性';android:lottie';编译(2.5.5)和运行时(2.5.6)类路径的版本不同
我在尝试运行react本机应用程序时遇到此错误,我手动将版本更改为2.5.6,但在下面遇到了不同的错误: [循环参考:com.android.tools.r8.ApiLevelException:Invoke customs ae仅支持从android O(-min-api 26)开始] 失败 失败:生成失败,出现异常React native Android依赖性';android:lottie';编译(2.5.5)和运行时(2.5.6)类路径的版本不同,react-native,React Native,我在尝试运行react本机应用程序时遇到此错误,我手动将版本更改为2.5.6,但在下面遇到了不同的错误: [循环参考:com.android.tools.r8.ApiLevelException:Invoke customs ae仅支持从android O(-min-api 26)开始] 失败 失败:生成失败,出现异常 出了什么问题: 任务“:app:transformClassesWithDexBuilderForDebug”的执行失败 com.android.build.api.trans
- 出了什么问题: 任务“:app:transformClassesWithDexBuilderForDebug”的执行失败 com.android.build.api.transform.TransformException:com.android.builder.DexrchiveBuilderException:com.android.builder.DexrchiveBuilderException:无法处理C:\Users\Dell.gradle\caches\transforms-1\files-1.1\lottie-2.5.6.aar\adddb5cebf38e2804a0cb857e5cf364\jars\classes.jar
- 尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。使用--scan运行以获得完整的洞察力
- 得到更多的帮助
dependencies {
compile project(':lottie-react-native')
implementation project(':lottie-react-native')
implementation('com.airbnb.android:lottie:2.5.5') {
exclude group: 'com.android.support'
}
看起来您在依赖项中添加了一个附加的依赖项 查看
lottie react native
repo中的,他们只添加compile项目(“:lottie react native”)
以下是它们对示例项目的依赖关系。(注意,编译
应替换为实现
)
请注意,它们没有
implementation('com.airbnb.android:lottie:2.5.5') {
exclude group: 'com.android.support'
}
在任何我使用过洛蒂的项目中,我从未添加过
implementation('com.airbnb.android:lottie:2.5.5')
如果你去掉那条线,你应该解决你的问题
仅从Android O(-min api 26)开始支持调用自定义 这个错误是由于Lottie依赖项需要java8字节码这一事实造成的。因此,要使其正常工作,我们需要在
app/build.gradle
中启用去糖化。所以我们需要告诉它使用Java8。我们通过更新android
部分来实现这一点
android {
defaultConfig {
...
}
// add the following
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
我已经删除了它,现在我得到了这个错误。任务“:app:transformClassesWithDexBuilderForDebug”的执行失败。“>com.android.build.api.transform.TransformException:com.android.builder.DexArchiveBuilderException:com.android.builder.DexArchiveBuilderException:未能处理C:\Users\Dell\.gradle\caches\transforms-1\files-1.1\lottie-2.5.6.aar\add5db5cebbf38e2804a0cb857e5cf364\jars\classes。jar不要在注释中发布大量代码,这是不可能读的。如果已启用即时运行,请尝试禁用它
Android Studio->File->Settings->Build,Execution,Deployment->Instant Run->Disable
Yeah已将其禁用。是否有其他修复方法?您在包中使用的lottie react native
是哪个版本的.json
?
android {
defaultConfig {
...
}
// add the following
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}