0

I updated Unity 5.3.4 to 5.4.1. When I try to export project as APK for Android, I am getting following error:

CommandInvokationFailure: Unable to convert classes into dex format.
C:/Program Files/Java/jdk1.8.0_91\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="D:/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "D:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzlu;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzlv;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzlw;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzlx;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzly;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzlz;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzma;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzmb;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzmc;

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 D:\Applications\Darbe\Temp\StagingArea\android-libraries\GoogleMobileAdsPlugin\libs\.\unity-plugin-library.jar...
ignored resource META-INF/
ignored resource META-INF/MANIFEST.MF
ignored resource com/
ignored resource com/google/
ignored resource com/google/unity/
processing com/google/unity/BuildConfig.class...
ignored resource com/google/unity/ads/
processing com/google/unity/ads/Banner.class...
processing com/google/unity/ads/Banner$1.class...
processing com/google/unity/ads/Banner$1$1.class...
processing com/google/unity/ads/Banner$2.class...
processing com/google/unity/ads/Banner$3.class...
processing com/google/unity/ads/Banner$4.class...
processing com/google/unity/ads/Banner$5.class...
processing com/google/unity/ads/CustomNativeAd.class...
processing com/google/unity/ads/CustomNativeAd$1.class...
processing com/google/unity/ads/CustomNativeAd$2.class...
processing com/google/unity/ads/Interstitial.class...
processing com/google/unity/ads/Interstitial$1.class...
processing com/google/unity/ads/Interstitial$1$1.class...
processing com/google/unity/ads/Interstitial$2.class...
processing com/google/unity/ads/Interstitial$3.class...
processing com/google/unity/ads/Interstitial$4.class...
processing com/google/unity/ads/Interstitial$5.class...
processing com/google/unity/ads/NativeAdLoader.class...
processing com/google/unity/ads/NativeAdLoader$1.class...
processing com/google/unity/ads/NativeAdLoader$2.class...
processing com/google/unity/ads/NativeAdLoader$3.class...
processing com/google/unity/ads/NativeAdLoader$3$1.class...
processing com/google/unity/ads/NativeAdLoader$3$2.class...
processing com/google/unity/ads/NativeAdLoader$3$3.class...
processing com/google/unity/ads/NativeAdLoader$4.class...
processing com/google/unity/ads/NativeExpressAd.class...
processing com/google/unity/ads/NativeExpressAd$1.class...
processing com/google/unity/ads/NativeExpressAd$1$1.class...
processing com/google/unity/ads/NativeExpressAd$2.class...
processing com/google/unity/ads/NativeExpressAd$3.class...
processing com/google/unity/ads/NativeExpressAd$4.class...
processing com/google/unity/ads/NativeExpressAd$5.class...
processing com/google/unity/ads/NativeExpressAd$6.class...
processing com/google/unity/ads/PluginUtils.class...
processing com/google/unity/ads/RewardBasedVideo.class...
processing com/google/unity/ads/RewardBasedVideo$1.class...
processing com/google/unity/ads/RewardBasedVideo$1$1.class...
processing com/google/unity/ads/RewardBasedVideo$2.class...
processing com/google/unity/ads/RewardBasedVideo$3.class...
processing com/google/unity/ads/UnityAdListener.class...
processing com/google/unity/ads/UnityCustomNativeAdListener.class...
processing com/google/unity/ads/UnityRewardBasedVideoAdListener.class...
processing archive D:\Applications\Darbe\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 D:\Applications\Darbe\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\libs\.\classes.jar...
ignored resource .readme
ignored resource META-INF/
ignored resource META-INF/MANIFEST.MF
ignored resource android/
ignored resource android/support/
ignored resource android/support/v7/
ignored resource android/support/v7/app/
processing android/support/v7/app/ActionBar.class...
processing android/support/v7/app/ActionBar$DisplayOptions.class...
processing android/support/v7/app/ActionBar$LayoutParams.class...
processing android/support/v7/app/ActionBar$NavigationMode.class...
processing android/support/v7/app/ActionBar$OnMenuVisibilityListener.class...
processing android/support/v7/app/ActionBar$OnNavigationListener.class...
processing android/support/v7/app/ActionBar$Tab.class...
processing android/support/v7/app/ActionBar$TabListener.class...
processing android/support/v7/app/ActionBarActivity.class...
processing android/support/v7/app/ActionBarDrawerToggle.class...
processing android/support/v7/app/ActionBarDrawerToggle$1.class...
processing android/support/v7/app/ActionBarDrawerToggle$Delegate.class...
processing android/support/v7/app/ActionBarDrawerToggle$DelegateProvider.class...
processing android/support/v7/app/ActionBarDrawerToggle$DrawerArrowDrawableToggle.class...
processing android/support/v7/app/ActionBarDrawerToggle$DrawerToggle.class...
processing android/support/v7/app/ActionBarDrawerToggle$DummyDelegate.class...
processing android/support/v7/app/ActionBarDrawerToggle$HoneycombDelegate.class...
processing android/support/v7/app/ActionBarDrawerToggle$JellybeanMr2Delegate.class...
processing android/support/v7/app/ActionBarDrawerToggle$ToolbarCompatDelegate.class...
processing android/support/v7/app/ActionBarDrawerToggleHoneycomb.class...
processing android/support/v7/app/ActionBarDrawerToggleHoneycomb$SetIndicatorInfo.class...
processing android/support/v7/app/AlertController.class...
processing android/support/v7/app/AlertController$1.class...
processing android/support/v7/app/AlertController$2.class...
processing android/support/v7/app/AlertController$3.class...
processing android/support/v7/app/AlertController$4.class...
processing android/support/v7/app/AlertController$5.class...
processing android/support/v7/app/AlertController$AlertParams.class...
processing android/support/v7/app/AlertController$AlertParams$1.class...
processing android/support/v7/app/AlertController$AlertParams$2.class...
processing android/support/v7/app/AlertController$AlertParams$3.class...
processing android/support/v7/app/AlertController$AlertParams$4.class...
processing android/support/v7/app/AlertController$AlertParams$OnPrepareListViewListener.class...
processing android/support/v7/app/AlertController$ButtonHandler.class...
processing android/support/v7/app/AlertController$CheckedItemAdapter.class...
processing android/support/v7/app/AlertDialog.class...
processing android/support/v7/app/AlertDialog$Builder.class...
processing android/support/v7/app/AppCompatActivity.class...
processing android/support/v7/app/AppCompatCallback.class...
processing android/support/v7/app/AppCompatDelegate.class...
processing android/support/v7/app/AppCompatDelegateImplBase.class...
processing android/support/v7/app/AppCompatDelegateImplBase$1.class...
processing android/support/v7/app/AppCompatDelegateImplBase$ActionBarDrawableToggleImpl.class...
processing android/support/v7/app/AppCompatDelegateImplBase$AppCompatWindowCallbackBase.class...
processing android/support/v7/app/AppCompatDelegateImplV11.class...
processing android/support/v7/app/AppCompatDelegateImplV14.class...
processing android/support/v7/app/AppCompatDelegateImplV14$AppCompatWindowCallbackV14.class...
processing android/support/v7/app/AppCompatDelegateImplV23.class...
processing android/support/v7/app/AppCompatDelegateImplV23$AppCompatWindowCallbackV23.class...
processing android/support/v7/app/AppCompatDelegateImplV7.class...
processing android/support/v7/app/AppCompatDelegateImplV7$1.class...
processing android/support/v7/app/AppCompatDelegateImplV7$2.class...
processing android/support/v7/app/AppCompatDelegateImplV7$3.class...
processing android/support/v7/app/AppCompatDelegateImplV7$4.class...
processing android/support/v7/app/AppCompatDelegateImplV7$5.class...
processing android/support/v7/app/AppCompatDelegateImplV7$5$1.class...
processing android/support/v7/app/AppCompatDelegateImplV7$6.class...
processing android/support/v7/app/AppCompatDelegateImplV7$ActionMenuPresenterCallback.class...
processing android/support/v7/app/AppCompatDelegateImplV7$ActionModeCallbackWrapperV7.class...
processing android/support/v7/app/AppCompatDelegateImplV7$ActionModeCallbackWrapperV7$1.class...
processing android/support/v7/app/AppCompatDelegateImplV7$ListMenuDecorView.class...
processing android/support/v7/app/AppCompatDelegateImplV7$PanelFeatureState.class...
processing android/support/v7/app/AppCompatDelegateImplV7$PanelFeatureState$SavedState.class...
processing android/support/v7/app/AppCompatDelegateImplV7$PanelFeatureState$SavedState$1.class...
processing android/support/v7/app/AppCompatDelegateImplV7$PanelMenuPresenterCallback.class...
processing android/support/v7/app/AppCompatDialog.class...
processing android/support/v7/app/AppCompatDialogFragment.class...
processing android/support/v7/app/AppCompatViewInflater.class...
processing android/support/v7/app/AppCompatViewInflater$DeclaredOnClickListener.class...
processing android/support/v7/app/NavItemSelectedListener.class...
processing android/support/v7/app/NotificationCompat.class...
processing android/support/v7/app/NotificationCompat$1.class...
processing android/support/v7/app/NotificationCompat$Builder.class...
processing android/support/v7/app/NotificationCompat$IceCreamSandwichExtender.class...
processing android/support/v7/app/NotificationCompat$JellybeanExtender.class...
processing android/support/v7/app/NotificationCompat$LollipopExtender.class...
processing android/support/v7/app/NotificationCompat$MediaStyle.class...
processing android/support/v7/app/NotificationCompatImpl21.class...
processing android/support/v7/app/NotificationCompatImplBase.class...
processing android/support/v7/app/ToolbarActionBar.class...
processing android/support/v7/app/ToolbarActionBar$1.class...
processing android/support/v7/app/ToolbarActionBar$2.class...
processing android/support/v7/app/ToolbarActionBar$ActionMenuPresenterCallback.class...
processing android/support/v7/app/ToolbarActionBar$MenuBuilderCallback.class...
processing android/support/v7/app/ToolbarActionBar$PanelMenuPresenterCallback.class...
processing android/support/v7/app/ToolbarActionBar$ToolbarCallbackWrapper.class...
processing android/support/v7/app/TwilightCalculator.class...
processing android/support/v7/app/TwilightManager.class...
processing android/support/v7/app/TwilightManager$1.class...
processing android/support/v7/app/TwilightManager$TwilightState.class...
processing android/support/v7/app/WindowDecorActionBar.class...
processing android/support/v7/app/WindowDecorActionBar$1.class...
processing android/support/v7/app/WindowDecorActionBar$2.class...
processing android/support/v7/app/WindowDecorActionBar$3.class...
processing android/support/v7/app/WindowDecorActionBar$ActionModeImpl.class...
processing android/support/v7/app/WindowDecorActionBar$TabImpl.class...
ignored resource android/support/v7/appcompat/
processing android/support/v7/appcompat/BuildConfig.class...
ignored resource android/support/v7/graphics/
ignored resource android/support/v7/graphics/drawable/
processing android/support/v7/graphics/drawable/DrawableUtils.class...
processing android/support/v7/graphics/drawable/DrawableWrapper.class...
processing android/support/v7/graphics/drawable/DrawerArrowDrawable.class...
processing android/support/v7/graphics/drawable/DrawerArrowDrawable$ArrowDirection.class...
ignored resource android/support/v7/text/
processing android/support/v7/text/AllCapsTransformationMethod.class...
ignored resource android/support/v7/transition/
processing android/support/v7/transition/ActionBarTransition.class...
ignored resource android/support/v7/view/
processing android/support/v7/view/ActionBarPolicy.class...
processing android/support/v7/view/ActionMode.class...
processing android/support/v7/view/ActionMode$Callback.class...
processing android/support/v7/view/CollapsibleActionView.class...
processing android/support/v7/view/ContextThemeWrapper.class...
processing android/support/v7/view/StandaloneActionMode.class...
processing android/support/v7/view/SupportActionModeWrapper.class...
processing android/support/v7/view/SupportActionModeWrapper$CallbackWrapper.class...
processing android/support/v7/view/SupportMenuInflater.class...
processing android/support/v7/view/SupportMenuInflater$InflatedOnMenuItemClickListener.class...
processing android/support/v7/view/SupportMenuInflater$MenuState.class...
processing android/support/v7/view/ViewPropertyAnimatorCompatSet.class...
processing android/support/v7/view/ViewPropertyAnimatorCompatSet$1.class...
processing android/support/v7/view/WindowCallbackWrapper.class...
ignored resource android/support/v7/view/menu/
processing android/support/v7/view/menu/ActionMenuItem.class...
processing android/support/v7/view/menu/ActionMenuItemView.class...
processing android/support/v7/view/menu/ActionMenuItemView$ActionMenuItemForwardingListener.class...
processing android/support/v7/view/menu/ActionMenuItemView$PopupCallback.class...
processing android/support/v7/view/menu/BaseMenuPresenter.class...
processing android/support/v7/view/menu/BaseMenuWrapper.class...
processing android/support/v7/view/menu/BaseWrapper.class...
processing android/support/v7/view/menu/ExpandedMenuView.class...
processing android/support/v7/view/menu/ListMenuItemView.class...
processing android/support/v7/view/menu/ListMenuPresenter.class...
processing android/support/v7/view/menu/ListMenuPresenter$MenuAdapter.class...
processing android/support/v7/view/menu/MenuBuilder.class...
processing android/support/v7/view/menu/MenuBuilder$Callback.class...
processing android/support/v7/view/menu/MenuBuilder$ItemInvoker.class...
processing android/support/v7/view/menu/MenuDialogHelper.class...
processing android/support/v7/view/menu/MenuItemImpl.class...
processing android/support/v7/view/menu/MenuItemImpl$1.class...
processing android/support/v7/view/menu/MenuItemWrapperICS.class...
processing android/support/v7/view/menu/MenuItemWrapperICS$ActionProviderWrapper.<message truncated>

I updated all plugins, Android SDKs and JDK. My project's min sdk is 9 (Android 2.3.1). I am using only Google Analytics, Google Play Games and Google Admob plugins. However I am still getting these error and I couldn't figure out how to fix this. Thanks.

Note: I deleted Unity completely install again as latest version. I clean projects and import then I import GooglePlayGames,GoogleAdMob,GoogleAnalytics in the given order and I am getting still same error. I applied all solutions to given answer however didn't work so I don't think that question and this are not same.

Note2: Google Play Services seems to be up-to-date however I couldn't find the folder google-play-services_lib/res which referred this question.

There is no folder which name is res

Note3: I delete sdk, Android, Studio and Unity then clean install. I only import Google Play Games plugin and GoogleMobileAds plugin. Now it give the following error:

Assets/GooglePlayGames/Editor/GPGSAndroidSetupUI.cs(113,47): error CS1501: No overload for method `DoResolution' takes `3' arguments

I found that this is a bug of googlemobileads. After I re-imported these 2 plugins; No overload for method DoResolution takes 3 arguments gone and I am still getting same error CommandInvokationFailure: Unable to convert classes into dex format. when I export apk.

Community
  • 1
  • 1
Aykut Uludağ
  • 1,876
  • 5
  • 18
  • 34
  • I don't think so. Please read my note section. I try everything what described in the given answer. – Aykut Uludağ Sep 25 '16 at 15:30
  • Hi @UmairM this is not a duplication of that question. This is a bug on Google Play Games for Unity plugin. – Aykut Uludağ Sep 25 '16 at 17:28
  • I explained the general solution here: http://stackoverflow.com/questions/28260722/error-building-player-commandinvokationfailure-unable-to-convert-classes-into/40644109#40644109 – Chong Lip Phang Nov 16 '16 at 23:26

2 Answers2

0

Finally I found a problem. Problem is unfortunately Google Play Games for Unity Plugin After I deleted plugin, I can able to export APK.

Update: Using this tutorial and its source code I can able to export as APK. Apperantly, latest version of Google Play Games is broken and not working on Unity 5.4.1. Just use source code which given in the tutorial.

Update 2: As I understand; GoogleAnalytics V4, GooglePlayGames, GoogleAdMob plugins are not compatible with latest Android SDK and/or latest Unity

Aykut Uludağ
  • 1,876
  • 5
  • 18
  • 34
0

You might want to check for duplicate classes in your project jars. I had similar issue, in my case the problem was: Unity/Framework/Assets/Plugins/Android/android-support-v4.jar Hope this helps.

MerlinBG
  • 338
  • 1
  • 5
  • 16
  • I believe it is not related to duplicate classes. It is related following problems: Google Analytics v4 plugin is not compatible with latest Android SDK & latest Unity. v3 is compatible. Google Play Games plugin is not compatible with latest Android SDK & latest Unity. AdMob plugin is not compatible with latest Android SDK & latest Unity. – Aykut Uludağ Sep 25 '16 at 20:35