Search Unity

Unable to convert class into DEX format [solved]

Discussion in 'Editor & General Support' started by ChaosEffect3, Nov 20, 2016.

  1. ChaosEffect3

    ChaosEffect3

    Joined:
    Dec 30, 2015
    Posts:
    3
    Hi,
    I am new to unity forums so please forgive me if there is anything I have done wrong.
    I have encountered an error which is stopping me from building my android game.
    All the scenes and other stuff seem to build ok but its just when it reaches the DEX conversion that it fails.
    This problem has been bugging me for 3 days now and I haven't found much help on other forums.
    As far as I understand, the DEX conversion is when the scripts are 'merged' into the apk so that the game becomes one file. many people have had this problem and all the forums seem to say that its conflicting scripts or .jar files with the same name. However, they all say to go into one's plugin folder and look for conflicting scripts but all I have Is the unity ads folder for android and IOS. I have checked and there are no files by the same name.
    I also found that the problem only occurs when I have unity ads toggled on the service window, suggesting the conflict is with unity ads files? Another thing I noticed is one of the lines of all the other error lists starts with 'UNEXPECTED TOP-LEVEL EXCEPTION' whereas mine starts with 'Uncaught translation error', I assume this means we have different problems?
    I'm sorry if this is all a bit long winded, I just wanted to add all the info I could, if there is anything else you need just ask.
    Thanks in advance for anyone willing to help.
    Here is the error in the console if it helps:

    CommandInvokationFailure: Unable to convert classes into dex format.
    D:/Java JDK\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="D:/android-sdk-windows\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
    stderr[
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/android/BuildConfig;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/android/IUnityAdsListener;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/android/UnityAds;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/android/UnityAds$1;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/android/UnityAds$2;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/android/UnityAds$3;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/android/UnityAdsDeviceLog;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/android/UnityAdsDeviceLog$1;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/unity3d/ads/android/UnityAdsDeviceLog$UnityAdsLogLevel;
    UNEXPECTED TOP-LEVEL EXCEPTION:
    java.lang.RuntimeException: Translation has been interrupted
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:613)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
    at com.android.dx.command.dexer.Main.run(Main.java:277)
    at com.android.dx.command.dexer.Main.main(Main.java:245)
    at com.android.dx.command.Main.main(Main.java:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at SDKMain.main(SDKMain.java:129)
    Caused by: java.lang.InterruptedException: Too many errors
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:605)
    ... 9 more
    ]
    stdout[
    processing archive C:\UnityGames\FallingSky\Temp\StagingArea\android-libraries\unityads-release\libs\.\classes.jar...
    ignored resource META-INF/
    ignored resource META-INF/MANIFEST.MF
    ignored resource com/
    ignored resource com/unity3d/
    ignored resource com/unity3d/ads/
    ignored resource com/unity3d/ads/android/
    processing com/unity3d/ads/android/BuildConfig.class...
    processing com/unity3d/ads/android/IUnityAdsListener.class...
    processing com/unity3d/ads/android/UnityAds.class...
    processing com/unity3d/ads/android/UnityAds$1.class...
    processing com/unity3d/ads/android/UnityAds$2.class...
    processing com/unity3d/ads/android/UnityAds$3.class...
    processing com/unity3d/ads/android/UnityAdsDeviceLog.class...
    processing com/unity3d/ads/android/UnityAdsDeviceLog$1.class...
    processing com/unity3d/ads/android/UnityAdsDeviceLog$UnityAdsLogLevel.class...
    processing com/unity3d/ads/android/UnityAdsDeviceLog$UnityAdsShowMsg.class...
    processing com/unity3d/ads/android/UnityAdsDeviceLogEntry.class...
    processing com/unity3d/ads/android/UnityAdsDeviceLogLevel.class...
    processing com/unity3d/ads/android/UnityAdsUtils.class...
    ignored resource com/unity3d/ads/android/cache/
    processing com/unity3d/ads/android/cache/UnityAdsCache.class...
    processing com/unity3d/ads/android/cache/UnityAdsCache$1.class...
    processing com/unity3d/ads/android/cache/UnityAdsCacheThread.class...
    processing com/unity3d/ads/android/cache/UnityAdsCacheThreadHandler.class...
    ignored resource com/unity3d/ads/android/campaign/
    processing com/unity3d/ads/android/campaign/UnityAdsCampaign.class...
    processing com/unity3d/ads/android/campaign/UnityAdsCampaign$UnityAdsCampaignStatus.class...
    ignored resource com/unity3d/ads/android/data/
    processing com/unity3d/ads/android/data/UnityAdsAdvertisingId.class...
    processing com/unity3d/ads/android/data/UnityAdsAdvertisingId$1.class...
    processing com/unity3d/ads/android/data/UnityAdsAdvertisingId$GoogleAdvertisingInfo.class...
    processing com/unity3d/ads/android/data/UnityAdsAdvertisingId$GoogleAdvertisingInfo$GoogleAdvertisingInfoBinder.class...
    processing com/unity3d/ads/android/data/UnityAdsAdvertisingId$GoogleAdvertisingInfo$GoogleAdvertisingInfoBinder$GoogleAdvertisingInfoImplementation.class...
    processing com/unity3d/ads/android/data/UnityAdsAdvertisingId$GoogleAdvertisingServiceConnection.class...
    processing com/unity3d/ads/android/data/UnityAdsDevice.class...
    ignored resource com/unity3d/ads/android/item/
    processing com/unity3d/ads/android/item/UnityAdsRewardItem.class...
    processing com/unity3d/ads/android/item/UnityAdsRewardItemManager.class...
    ignored resource com/unity3d/ads/android/properties/
    processing com/unity3d/ads/android/properties/UnityAdsConstants.class...
    processing com/unity3d/ads/android/properties/UnityAdsProperties.class...
    ignored resource com/unity3d/ads/android/unity3d/
    processing com/unity3d/ads/android/unity3d/UnityAdsUnityEngineWrapper.class...
    processing com/unity3d/ads/android/unity3d/UnityAdsUnityEngineWrapper$1.class...
    processing com/unity3d/ads/android/unity3d/UnityAdsUnityWrapper.class...
    processing com/unity3d/ads/android/unity3d/UnityAdsUnityWrapper$1.class...
    ignored resource com/unity3d/ads/android/video/
    processing com/unity3d/ads/android/video/IUnityAdsVideoPlayerListener.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPausedView.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$1.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$2.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$3.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$4.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$5.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$6.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$7.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$8.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$9.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker$1.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker$2.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker$3.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker$4.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker$5.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker$6.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoView.class...
    ignored resource com/unity3d/ads/android/view/
    processing com/unity3d/ads/android/view/UnityAdsFullscreenActivity.class...
    processing com/unity3d/ads/android/view/UnityAdsFullscreenActivity$1.class...
    processing com/unity3d/ads/android/view/UnityAdsFullscreenActivity$UnityAdsPlayVideoRunner.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView$1.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView$2.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView$2$1.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView$3.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView$4.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView$UnityAdsMainViewState.class...
    processing com/unity3d/ads/android/view/UnityAdsMuteVideoButton.class...
    processing com/unity3d/ads/android/view/UnityAdsMuteVideoButton$1.class...
    processing com/unity3d/ads/android/view/UnityAdsMuteVideoButton$UnityAdsMuteVideoButtonState.class...
    processing com/unity3d/ads/android/view/UnityAdsViewUtils.class...
    ignored resource com/unity3d/ads/android/webapp/
    processing com/unity3d/ads/android/webapp/IUnityAdsWebBridgeListener.class...
    processing com/unity3d/ads/android/webapp/IUnityAdsWebDataListener.class...
    processing com/unity3d/ads/android/webapp/IUnityAdsWebViewListener.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebBridge.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebBridge$1.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebBridge$UnityAdsWebEvent.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebData.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebData$1.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebData$2.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebData$3.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebData$4.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebData$5.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebData$6.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebData$UnityAdsCancelUrlLoaderRunner.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebData$UnityAdsRequestType.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebData$UnityAdsUrlLoader.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebData$UnityAdsUrlLoaderCreator.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebData$UnityAdsVideoPosition.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebView.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebView$1.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebView$UnityAdsJavascriptRunner.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebView$UnityAdsViewChromeClient.class...
    processing com/unity3d/ads/android/webapp/UnityAdsWebView$UnityAdsViewClient.class...
    ignored resource com/unity3d/ads/android/zone/
    processing com/unity3d/ads/android/zone/UnityAdsIncentivizedZone.class...
    processing com/unity3d/ads/android/zone/UnityAdsZone.class...
    processing com/unity3d/ads/android/zone/UnityAdsZoneManager.class...
    processing archive C:\UnityGames\FallingSky\Temp\StagingArea\android-libraries\unityads\libs\.\unity-ads.jar...
    ignored resource META-INF/
    ignored resource META-INF/MANIFEST.MF
    ignored resource com/
    ignored resource com/unity3d/
    ignored resource com/unity3d/ads/
    ignored resource com/unity3d/ads/android/
    processing com/unity3d/ads/android/BuildConfig.class...
    processing com/unity3d/ads/android/IUnityAdsListener.class...
    processing com/unity3d/ads/android/UnityAds.class...
    processing com/unity3d/ads/android/UnityAds$1.class...
    processing com/unity3d/ads/android/UnityAds$2.class...
    processing com/unity3d/ads/android/UnityAds$3.class...
    processing com/unity3d/ads/android/UnityAdsDeviceLog.class...
    processing com/unity3d/ads/android/UnityAdsDeviceLog$1.class...
    processing com/unity3d/ads/android/UnityAdsDeviceLog$UnityAdsLogLevel.class...
    processing com/unity3d/ads/android/UnityAdsDeviceLog$UnityAdsShowMsg.class...
    processing com/unity3d/ads/android/UnityAdsDeviceLogEntry.class...
    processing com/unity3d/ads/android/UnityAdsDeviceLogLevel.class...
    processing com/unity3d/ads/android/UnityAdsUtils.class...
    ignored resource com/unity3d/ads/android/cache/
    processing com/unity3d/ads/android/cache/UnityAdsCache.class...
    processing com/unity3d/ads/android/cache/UnityAdsCache$1.class...
    processing com/unity3d/ads/android/cache/UnityAdsCacheThread.class...
    processing com/unity3d/ads/android/cache/UnityAdsCacheThreadHandler.class...
    ignored resource com/unity3d/ads/android/campaign/
    processing com/unity3d/ads/android/campaign/UnityAdsCampaign.class...
    processing com/unity3d/ads/android/campaign/UnityAdsCampaign$UnityAdsCampaignStatus.class...
    ignored resource com/unity3d/ads/android/data/
    processing com/unity3d/ads/android/data/UnityAdsAdvertisingId.class...
    processing com/unity3d/ads/android/data/UnityAdsAdvertisingId$1.class...
    processing com/unity3d/ads/android/data/UnityAdsAdvertisingId$GoogleAdvertisingInfo.class...
    processing com/unity3d/ads/android/data/UnityAdsAdvertisingId$GoogleAdvertisingInfo$GoogleAdvertisingInfoBinder.class...
    processing com/unity3d/ads/android/data/UnityAdsAdvertisingId$GoogleAdvertisingInfo$GoogleAdvertisingInfoBinder$GoogleAdvertisingInfoImplementation.class...
    processing com/unity3d/ads/android/data/UnityAdsAdvertisingId$GoogleAdvertisingServiceConnection.class...
    processing com/unity3d/ads/android/data/UnityAdsDevice.class...
    ignored resource com/unity3d/ads/android/item/
    processing com/unity3d/ads/android/item/UnityAdsRewardItem.class...
    processing com/unity3d/ads/android/item/UnityAdsRewardItemManager.class...
    ignored resource com/unity3d/ads/android/properties/
    processing com/unity3d/ads/android/properties/UnityAdsConstants.class...
    processing com/unity3d/ads/android/properties/UnityAdsProperties.class...
    ignored resource com/unity3d/ads/android/unity3d/
    processing com/unity3d/ads/android/unity3d/UnityAdsUnityEngineWrapper.class...
    processing com/unity3d/ads/android/unity3d/UnityAdsUnityEngineWrapper$1.class...
    processing com/unity3d/ads/android/unity3d/UnityAdsUnityWrapper.class...
    processing com/unity3d/ads/android/unity3d/UnityAdsUnityWrapper$1.class...
    ignored resource com/unity3d/ads/android/video/
    processing com/unity3d/ads/android/video/IUnityAdsVideoPlayerListener.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPausedView.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$1.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$2.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$3.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$4.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$5.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$6.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$7.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$8.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$9.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker$1.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker$2.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker$3.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker$4.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker$5.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoPlayView$VideoStateChecker$6.class...
    processing com/unity3d/ads/android/video/UnityAdsVideoView.class...
    ignored resource com/unity3d/ads/android/view/
    processing com/unity3d/ads/android/view/UnityAdsFullscreenActivity.class...
    processing com/unity3d/ads/android/view/UnityAdsFullscreenActivity$1.class...
    processing com/unity3d/ads/android/view/UnityAdsFullscreenActivity$UnityAdsPlayVideoRunner.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView$1.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView$2.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView$2$1.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView$3.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView$4.class...
    processing com/unity3d/ads/android/view/UnityAdsMainView$UnityAdsMainViewState.class...
    processing
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,158
    It may be, that by toggling "Unity ads" in the service window, Unity will actually add the needed libraries (for Android). If you also include the same libraries in your project (under Plugins/Android), it will cause a conflict, as you include the same libraries more than once.

    Looking at your error, it definitely looks like Unity ads is being included twice.
     
    ChaosEffect3 likes this.
  3. vimalb

    vimalb

    Joined:
    May 16, 2016
    Posts:
    1
    I also faced the same problem.

    What is the JDK you are using?

    I just updated my JDK from 1.7 to 1.8.

    The error gone all of a sudden.

    Try and post the update.
     
  4. ChaosEffect3

    ChaosEffect3

    Joined:
    Dec 30, 2015
    Posts:
    3
    Thank you so much liortal, I tried what you said and it worked perfectly!
    I'm using JDK 1.7 and don't really feel a need to go through the hassle of updating.
    Is there some way I can make this forum closed and also any way I can state that you fixed my error?
    You have helped me so much thanks, cant even put into words how much of a help this is XD
     
  5. LTHendrix

    LTHendrix

    Joined:
    Jul 29, 2013
    Posts:
    6
    I'm having the same issue. I'm not a programmer. What do you have to do to fix it?

    Thank you.
     
  6. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,158
    @texashoss are you sure it's exactly the same issue? you should install JDK 8. should solve the problem.
     
  7. AkashShukla

    AkashShukla

    Joined:
    Dec 29, 2018
    Posts:
    2
    I am using Unity 2018.2.0.0f2 with Vuforia 6-2-10 and JDK1.8.0_77 and nothing else. I have also tried changing the sdk and jdk paths still the error won't go. I have also tried deleting the duplicate files but it just seems too many of them moreover I can only find duplicate .dll files and not (.arr) and (.jar) files. I have also tried reinstalling the android and iOS support from the Unity Download Assistant but still I am getting the same error. Here's the error log:
    CommandInvokationFailure: Unable to convert classes into dex format.
    C:/NVPACK/jdk1.8.0_77\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/NVPACK/android-sdk-windows\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

    stderr[
    Error:Invalid command dx
    ]
    stdout[

    ]

    exit code: 64

    UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.AndroidSDKTools.RunCommand (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg, Int32 memoryMB)

    UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr)
     
    Last edited: Jan 10, 2019
  8. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,158