我想在物理设备上运行我的项目。但是,当我运行android Build时失败。 然后出现错误。
任务:app:transformDexArchiveWithDexMergerForDebug失败
C:\Users\Alperen\Desktop\AwesomeProject>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 885 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
> Task :app:transformDexArchiveWithDexMergerForDebug FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings
36 actionable tasks: 2 executed, 34 up-to-date
D8: Program type already present: com.zmxv.RNSound.BuildConfig
java.lang.RuntimeException: java.lang.RuntimeException: 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.zmxv.RNSound.BuildConfig
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:66)
... 11 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: 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.zmxv.RNSound.BuildConfig
* 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
BU�LD FAILED in 7s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
D8: Program type already present: com.zmxv.RNSound.BuildConfig
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
注意:
我正在使用11.jdk版本。
这只是一个世界项目。
昨天我为apk顺利构建。
如何解决该问题?
答案 0 :(得分:0)
处理任何Android Studio特定错误的最佳选择是进行一次Clean + rebuild。
有时候模块编译趋于混乱,因此在def a(b):
val = b.split()
return (int(val[0]) if "." not in val[0] else float(val[0]), str(val[1]), int(val[2]) if "." not in val[2] else float(val[2]), str(val[3]))
res = a("35 age 6 ft")
print(res)
文件夹中运行应该会有所帮助。
android
在运行这两个命令之前,请确保已退出Android Studio。