Closed thiagopeluque closed 3 years ago
Go to Android/app/build.gradle
Add following configuration:-
android {
...
configurations {
all*.exclude group: 'com.google.zxing'
}
}
After this another error appears. I didn't understand why.
Task :app:mergeExtDexDebug FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings 544 actionable tasks: 543 executed, 1 up-to-date Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\ProjetosReact\eTag\node_modules\expo-constants\android\src\main\java\expo\modules\constants\ConstantsService.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\ProjetosReact\eTag\node_modules\expo-file-system\android\src\main\java\expo\modules\filesystem\FileSystemModule.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: C:\ProjetosReact\eTag\node_modules\@leesiongchan\react-native-esc-pos\android\src\main\java\leesiongchan\reactnativeescpos\EscPosModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\ProjetosReact\eTag\node_modules\@react-native-async-storage\async-storage\android\src\main\java\com\reactnativecommunity\asyncstorage\AsyncStorageModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: C:\ProjetosReact\eTag\node_modules\react-native-reanimated\android\src\main\java\com\swmansion\reanimated\NodesManager.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\ProjetosReact\eTag\node_modules\react-native-reanimated\android\src\main\java\com\swmansion\reanimated\NodesManager.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: C:\ProjetosReact\eTag\android\app\src\debug\java\com\etag\ReactNativeFlipper.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. D8: Program type already present: zj.com.customize.sdk.Other 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: zj.com.customize.sdk.Other at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131) at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118) at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102) at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444) at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335) at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:57) at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63) at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66) at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62) at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98) at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62) at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44) at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41) at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416) at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406) at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158) at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102) at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36) at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41) at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59) at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:198) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215) at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164) at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56) at java.lang.Thread.run(Thread.java:745) Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete at com.android.tools.r8.utils.t.a(:55) at com.android.tools.r8.D8.run(:11) at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116) ... 33 more Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: zj.com.customize.sdk.Other at com.android.tools.r8.utils.Reporter.a(:21) at com.android.tools.r8.utils.Reporter.a(:7) at com.android.tools.r8.utils.t.a(:36) ... 35 more
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:mergeExtDexDebug'.
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: zj.com.customize.sdk.Other
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 3m 4s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 Note: Some input files use unchecked or unsafe operations.
Resolved
Before:
defaultConfig { applicationId "com.etag" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" }
After:
defaultConfig { applicationId "com.etag" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" **multiDexEnabled true** }
I'm using 'expo-barcode-scanner' in my App (using unimodules) and when I try to run the application an error appears Duplicated Class 'com.google.zxing'