thi*_*rez 5 android gradle dex react-native react-native-svg
请考虑我对Android开发不是很熟悉。
尝试为我的 React Native 应用程序生成 Android 签名包时,我偶然发现了以下错误:
Task :app:mergeDexRelease FAILED
D8: Program type already present: com.horcrux.svg.Brush$BrushType
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at
https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.horcrux.svg.Brush$BrushType
...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDexRelease'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.horcrux.svg.Brush$BrushType
Run Code Online (Sandbox Code Playgroud)
BrushType是一个来自react-native-svggradlew app:dependencies并发现没有模块依赖于Brush或与com.horcrux.svg或相关的任何内容react-native-svg.iml文件,使Android Studio缓存失效,重建,重新安装node_modules等build.gradle并gradle.properties没有运气我知道有 2 个或更多依赖项在使用,com.horcrux.svg.Brush$BrushType但我找不到它们。我想一旦我找到它们,我就可以做到
implementation(:my-library) {
exclude ...
}
Run Code Online (Sandbox Code Playgroud)
正确的?
android.useAndroidX=true
android.enableJetifier=true
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2560m
Run Code Online (Sandbox Code Playgroud)
dependencies {
implementation project(':react-native-appearance')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':watermelondb')
implementation project(':react-native-calendar-events')
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
Run Code Online (Sandbox Code Playgroud)
提前致谢。
编辑:
通过添加解决:
implementation(project(':react-native-jitsi-meet')) {
...
exclude group: 'com.facebook.react',module:'react-native-svg'
...
}
Run Code Online (Sandbox Code Playgroud)
就我而言,react-native-jitsi-meet这是导致冲突的原因,我必须通过反复试验找到它。
defaultConfig {
..............
multiDexEnabled true
}
dependencies {
..............
implementation 'androidx.multidex:multidex:2.0.1'
}
public class MyApplication extends MultiDexApplication {
..............
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5564 次 |
| 最近记录: |