Android Error: Error converting bytecode to dex:

created at 07-10-2021 views: 9


When I connected to the RN, I needed to modify the original old project. I encountered many problems when compiling and running. The most headache is this

Error:Error converting bytecode to dex:

class name (us/webView/BSDialogUtilsForWebView) does not match path (us/webview/BSDialogUtilsForWebView.class)
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

> java.lang.RuntimeException: java.util.concurrent.ExecutionException: Error while executing java process with main class with arguments {--dex --force-jumbo --num-threads=4 --multi-dex --output /Users/majianguang/work/androidwork/android-idcamera/app/build/intermediates/transforms/dex/debug/folders/1000/5/slice_8 /Users/majianguang/work/androidwork/android-idcamera/app/build/intermediates/transforms/instantRunSlicer/debug/folders/1/5/slice_8}

I checked countless methods on the Internet, but they didn’t work. I said that there may be repeated importing of the package, or the code method may exceed the standard, etc., and I added it and tried it.


Finally, I found that it was a problem of hot compilation and subcontracting. I don’t know the specifics, but there may be a problem with Android Studio 2.3.3

Open the preferences of Android Studio:

Android Studio

Just remove the check mark in the figure above, no need to update and compile in real time.

Then the problem is solved.

created at:07-10-2021
edited at: 07-10-2021: