question

fabula.leonis@gmail.com avatar image
fabula.leonis@gmail.com asked

JAR conflict with Unity (Android)

Hello,

I'm trying to start over with PlayFab in my Unity project, few months after having some DEX issue on build in another project, hoping for better compatibility this time... and unfortunately I'm having the same problem with latest versions of the plugin (Master unitypackage on GitHub) and Unity 5.3.

The issue comes potentially from multiple definitions of the same class in different JAR, as I managed to build by removing support-v4 and support-v7 JAR files. My other plugins are notably Google AdMob SDK, Photon (PUN), and activating Unity Ads.

Now, would there be a less radical way to solve this issue than removing the JARs altogether ? I bet this dirty solution won't let me go that easy and provoke bugs/crashes later on when I'll be calling PlayFab API...

Thanks

ps: the detail error below

Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
C:\Program Files\Java\jdk1.8.0_65\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Softwares/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Softwares\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/annotation/AnimRes;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/annotation/AnimatorRes;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/annotation/AnyRes;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/annotation/ArrayRes;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/annotation/AttrRes;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/annotation/BinderThread;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/annotation/BoolRes;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/annotation/CallSuper;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/annotation/CheckResult;

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:608)
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:497)
at SDKMain.main(SDKMain.java:129)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:600)
... 9 more
]
stdout[
ignored resource C:\Documents\work\xxx\aaa\bbb\Temp\StagingArea\android-libraries\GoogleMobileAdsPlugin\libs\.\PLUGIN_JAR_GOES_HERE
processing archive C:\Documents\work\xxx\aaa\bbb\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/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/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/RewardBasedVideo$4.class...
processing com/google/unity/ads/UnityBannerAdListener.class...
processing com/google/unity/ads/UnityInterstitialAdListener.class...
processing com/google/unity/ads/UnityRewardBasedVideoAdListener.class...
processing archive C:\Documents\work\xxx\aaa\bbb\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\bin\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.class...
processing android/support/v7/view/menu/MenuItemWrapperICS$CollapsibleActionViewWrapper.class...
processing android/support/v7/view/menu/MenuItemWrapperICS$OnActionExpandListenerWrapper.class...
processing android/support/v7/view/menu/MenuItemWrapperICS$OnMenuItemClickListenerWrapper.class...
processing android/support/v7/view/menu/MenuItemWrapperJB.class...
processing android/support/v7/view/menu/MenuItemWrapperJB$ActionProviderWrapperJB.class...
processing android/support/v7/view/menu/MenuPopupHelper.class...
processing android/support/v7/view/menu/MenuPopupHelper$MenuAdapter.class...
processing android/support/v7/view/menu/MenuPresenter.class...
processing android/support/v7/view/menu/MenuPresenter$Callback.class...
processing android/support/v7/view/menu/MenuView.class...
processing android/support/v7/view/menu/MenuView$ItemView.class...
processing android/support/v7/view/menu/MenuWrapperFactory.class...
processing android/support/v7/view/menu/MenuWrapperICS.class...
processing android/support/v7/view/menu/SubMenuBuilder.class...
processing android/support/v7/view/menu/SubMenuWrapperICS.class...
ignored resource android/support/v7/widget/
processing android/support/v7/widget/AbsActionBarView.class...
processing android/support/v7/widget/AbsActionBarView$1.class...
processing android/support/v7/widget/AbsActionBarView$VisibilityAnimListener.class...
processing android/support/v7/widget/ActionBarBackgroundDrawable.class...
processing android/support/v7/widget/ActionBarBackgroundD<message truncated>

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Right now, that is indeed the correct way to manage this on Android. The folks at Google are working on this, but right now, deleting the oldest library version is the way to go (you'll find this is the way to manage this for builds using other services, like OneSignal, as well). That's actually why our library files have been renamed to expose the version numbers as clearly as possible - to help in determining which is newest.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

fabula.leonis@gmail.com avatar image
fabula.leonis@gmail.com answered

Thanks for the quick reply. I indeed deleted those 2 JAR, but there are no other JAR now in the project with a similar name or that could hint as implementing the same classes... seems a bit brute force now, and I expect issues to come when I'll be really using the API.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Sorry, are you saying that you deleted them, but you're still running into build issues?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

fabula.leonis@gmail.com avatar image
fabula.leonis@gmail.com answered

Build is ok after removing both JAR. I was worried that not having them might create issues once deployed on device.

I now got my first implementation running on device, and first tests show I can login, request & update user data... all good :-) .

Thanks for the support

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

contact@dojo-arcade.com avatar image
contact@dojo-arcade.com answered

We just installed playfab and are having this issue, although we can't be sure as we have a few different plugins installed.  So if I understand it correctly, playfab comes with support-v4.jar and support-7.jar but this is currently incompatible with Unity 5.3.  So we just need to delete v4 and we are good to go?  Many thanks.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

No, none of the JAR files within the PlayFab conflict with each other, so the Appcompat (v7) JAR is actually different from the v4 JAR. If there's another v4 or another v7 in your project from another provider, you should delete whichever is older.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Arjuna avatar image
Arjuna answered

I had this same problem earlier today, but got it working.

I'm using PlayFab, OneSignal and Facebook.

I think all three of them use support-v4. 

 

Click on Assets in Unity. search for "support" 

You should see your support-v4xxxx jars filtered out. Keep the one with the highest version and delete the others. In my case, I had to delete Playfab's jar as it was older than the others:

Facebook : support-v4-23.1.1   <-------- I kept this one.

OneSignal: support-v4

Playfab: support-v4-23.1.0 I think?

I don't think you have to delete support-v7

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.