[Unity] (Edited2) Unable to convert classes into dex format

edited in General
This message shows in console

Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
C:/Program Files/Java/jdk1.8.0_102\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Program Files (x86)/Android/android-sdk\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: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoJellyBeanMr2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoStubImpl;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatJellyBeanMr2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ActionBarDrawerToggle;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ActionBarDrawerToggle$1;

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:\Users\Saad\Desktop\Unity\ZigZag\New Unity Project\Temp\StagingArea\android-libraries\MainLibProj\libs\.\play-games-plugin-support.jar...
ignored resource META-INF/
ignored resource META-INF/MANIFEST.MF
ignored resource com/
ignored resource com/google/
ignored resource com/google/games/
ignored resource com/google/games/bridge/
processing com/google/games/bridge/BuildConfig.class...
processing com/google/games/bridge/NativeBridgeActivity.class...
processing com/google/games/bridge/TokenFragment.class...
processing com/google/games/bridge/TokenFragment$1.class...
processing com/google/games/bridge/TokenFragment$TokenRequest.class...
processing com/google/games/bridge/TokenPendingResult.class...
processing com/google/games/bridge/TokenResult.class...
processing archive C:\Users\Saad\Desktop\Unity\ZigZag\New Unity Project\Temp\StagingArea\android-libraries\play-services-base-9.4.0\libs\.\classes.jar...
ignored resource META-INF/
ignored resource META-INF/MANIFEST.MF
ignored resource com/
ignored resource com/google/
ignored resource com/google/android/
ignored resource com/google/android/gms/
ignored resource com/google/android/gms/auth/
......................................(more some of this type of line)........................................
processing com/go<message truncated>

Comments

  • edited
    Since the value is already stored inside PlayerPrefs why not just load it from there in script 2 as well?
    I believe the code for this is: int PlayerScore = PlayerPrefs.GetInt("HiScore"); or just replace the 100 in script2 with PlayerPrefs.GetInt("HiScore")

    Otherwise take a look at DontDestroyOnLoad it works but I am not sure if this is the best way of going about it.

    Basically you place an empty gameObject in the scene you want to access from scene2, and on that object add your script with public variables containing the data you need. Then you can use GameObject.Find() to access that gameObject from scene 2.
    Thanked by 1saad101
  • vince said:
    Since the value is already stored inside PlayerPrefs why not just load it from there in script 2 as well?
    I believe the code for this is: int PlayerScore = PlayerPrefs.GetInt("HiScore"); or just replace the 100 in script2 with PlayerPrefs.GetInt("HiScore")

    Otherwise take a look at DontDestroyOnLoad it works but I am not sure if this is the best way of going about it.

    Basically you place an empty gameObject in the scene you want to access from scene2, and on that object add your script with public variables containing the data you need. Then you can use GameObject.Find() to access that gameObject from scene 2.
    I think it worked, no compile error this time. Thanks a looot!!
    Gonna go and try on actual device.
  • vince said:
    l
    Encountered another problem, I dont know waht i did wrong but the scene is not changing when button is pressed.

    -Made a script Csharp
    -Added it to a gameObject
    -Made another button and added the gameObject to OnClick

    image
  • The function you point to in the inspector should not take any parameters. You'll probably find in your Console window that it also doesn't know what value index or levelName should be.
  • Fengol said:
    The function you point to in the inspector should not take any parameters. You'll probably find in your Console window that it also doesn't know what value index or levelName should be.
    Solved the problem, thanks
  • Fengol said:
    .
    While packing the apk file a error message shows that unable to conver classs into dex format :/
  • edited
    I have no idea. Have you tried Google?
  • Fengol said:
    I have no idea. Have you tried Google?
    ya tried but found nothing. But problem is solved now. moved some files around.
    Thanks again for your help
  • In my experience, dex errors on Android are usually due to having multiple libraries (jar/aar) in your project that are built with different versions of Java. Often this happens if you are building your own jar or aar libs and you've updated your JDK to the latest one.

    I can't recall what is the highest version of JDX that you should have installed / as your JAVA_HOME off the top of my head, but you generally don't want the most up to date stuff. You probably only want to be using 7.0 or 7.1 or something.
  • In my experience, dex errors on Android are usually due to having multiple libraries (jar/aar) in your project that are built with different versions of Java. Often this happens if you are building your own jar or aar libs and you've updated your JDK to the latest one.

    I can't recall what is the highest version of JDX that you should have installed / as your JAVA_HOME off the top of my head, but you generally don't want the most up to date stuff. You probably only want to be using 7.0 or 7.1 or something.
    The issue is fixed now,
    probably i had same type of doubled files, after i deleted some files and re imported it the issue got fixed.
Sign In or Register to comment.