Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
412 views
in Technique[技术] by (71.8m points)

android - 任务':app:transformDexArchiveWithDexMergerForDebug'的执行失败。 -React Native(Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'. - React Native)

I have App written with react-native and it's work very fine previously but when I install RN async-storage .

(我有用react-native编写的App,以前运行很好, 但是当我安装RN async-storage时 。)

I don't change anything in native android code

(我不更改本地android代码中的任何内容)

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

(但是在运行react-native run-android)

I got

(我有)

What went wrong: Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.

(出了什么问题:任务':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.

(com.android.build.api.transform.TransformException:java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:合并dex归档时出错:.dex文件中方法引用的数量不能超过64K。)

Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

(在https://developer.android.com/tools/building/multidex.html上了解如何解决此问题。)

So how can I solve it?

(那么我该如何解决呢?)

  ask by Oliver D translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The right way to uninstall a npm package is

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

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

(如果你只是删除node_modules它不会从被删除package.json文件,当u做NPM重新安装,如果不从删除的软件包将被安装package.json文件在这里详细教育部在错误的最后一行记录其如前所述)

The number of method references in a .dex file cannot exceed 64K.

(.dex文件中方法引用的数量不能超过64K。)

Learn how to resolve this issue at to fix this error u might need to enable multidex as mentioned here

(了解如何解决此问题,以解决此错误, 如此处所述 ,您可能需要启用multidex)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...