任务':app:transformDexArchiveWithDexMergerForDebug'的执行失败. -反应本机 [英] Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'. - React Native

查看:600
本文介绍了任务':app:transformDexArchiveWithDexMergerForDebug'的执行失败. -反应本机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有用react-native编写的App,以前工作正常,但当我安装 https://developer.android.com/tools/building/multidex.html

那我该如何解决呢?

解决方案

卸载npm软件包的正确方法是

npm uninstall <name> --save

如果仅删除node_modules,它将不会从package.json文件中删除,如果您再次执行npm安装,则如果未从package.json文件中删除该软件包,则会安装该软件包.可能需要启用此处提到的multidex

I have App written with react-native and it's work very fine previously but when I install RN async-storage. I don't change anything in native android code

I got an error when running the app.

I'm trying to remove it and rebuild my app BUT the issue still I don't know why!

I'm tried to run these command

rm -rf node_modules 
npm install

then

cd android && gradlew clean

and it's building successfully without any error

but after run react-native run-android

I got

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: The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

So how can I solve it?

解决方案

The right way to uninstall a npm package is

npm uninstall <name> --save

If you simply remove node_modules it wont be removed from package.json file, when u do npm install again the package will be installed if is not removed from package.json files moe detail here In the last line in the error log its mentioned as

The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at to fix this error u might need to enable multidex as mentioned here

这篇关于任务':app:transformDexArchiveWithDexMergerForDebug'的执行失败. -反应本机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆