问题
In my game, after importing Google play games plugin and Facebook plugin, I cant build my Unity Project . It gives a build error, Unable to convert classes to dex format. The Unity version is 5.3.4f1. The google play games plugin version is 0.9.32. Facebook plugin version is 7.5.0. The error log that I'm getting is this:
CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
C:\Program Files\Java\jdk1.8.0_31\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="E:/Adt/adt-bundle-windows-x86_64-20140702/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/BuildConfig;
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/animation/AnimatorCompatHelper;
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: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:483)
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[
processing archive F:\User\path1\path2\path3\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$2.class...
processing com/google/games/bridge/TokenFragment$3.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 F:\User\path1\path2\path3\Temp\StagingArea\android-libraries\cardview-v7-23.2.1\bin\classes.jar...
processing android/support/v7/cardview/BuildConfig.class...
processing android/support/v7/widget/CardView.class...
processing android/support/v7/widget/CardViewApi21.class...
processing android/support/v7/widget/CardViewDelegate.class...
processing android/support/v7/widget/CardViewEclairMr1.class...
processing android/support/v7/widget/CardViewEclairMr1$1.class...
processing android/support/v7/widget/CardViewImpl.class...
processing android/support/v7/widget/CardViewJellybeanMr1.class...
processing android/support/v7/widget/CardViewJellybeanMr1$1.class...
processing android/support/v7/widget/RoundRectDrawable.class...
processing android/support/v7/widget/RoundRectDrawableWithShadow.class...
processing android/support/v7/widget/RoundRectDrawableWithShadow$RoundRectHelper.class...
processing archive F:\User\path1\path2\path3\Temp\StagingArea\android-libraries\facebook-android-sdk-4.11.0\bin\classes.jar...
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/cardview/
ignored resource com/
ignored resource com/facebook/
processing com/facebook/AccessToken.class...
processing com/facebook/AccessToken$1.class...
processing com/facebook/AccessToken$2.class...
processing com/facebook/AccessToken$AccessTokenCreationCallback.class...
processing com/facebook/AccessToken$AccessTokenRefreshCallback.class...
processing com/facebook/AccessTokenCache.class...
processing com/facebook/AccessTokenCache$SharedPreferencesTokenCachingStrategyFactory.class...
processing com/facebook/AccessTokenManager.class...
processing com/facebook/AccessTokenManager$1.class...
processing com/facebook/AccessTokenManager$2.class...
processing com/facebook/AccessTokenManager$3.class...
processing com/facebook/AccessTokenManager$4.class...
processing com/facebook/AccessTokenManager$RefreshResult.class...
processing com/facebook/AccessTokenSource.class...
processing com/facebook/AccessTokenTracker.class...
processing com/facebook/AccessTokenTracker$1.class...
processing com/facebook/AccessTokenTracker$CurrentAccessTokenBroadcastReceiver.class...
processing com/facebook/BuildConfig.class...
processing com/facebook/CallbackManager.class...
processing com/facebook/CallbackManager$Factory.class...
processing com/facebook/CustomTabActivity.class...
processing com/facebook/FacebookActivity.class...
processing com/facebook/FacebookAuthorizationException.class...
processing com/facebook/FacebookBroadcastReceiver.class...
processing com/facebook/FacebookButtonBase.class...
processing com/facebook/FacebookButtonBase$1.class...
processing com/facebook/FacebookCallback.class...
processing com/facebook/FacebookContentProvider.class...
processing com/facebook/FacebookDialog.class...
processing com/facebook/FacebookDialogException.class...
processing com/facebook/FacebookException.class...
processing com/facebook/FacebookGraphResponseException.class...
processing com/facebook/FacebookOperationCanceledException.class...
processing com/facebook/FacebookRequestError.class...
processing com/facebook/FacebookRequestError$1.class...
processing com/facebook/FacebookRequestError$Category.class...
processing com/facebook/FacebookRequestError$Range.class...
processing com/facebook/FacebookSdk.class...
processing com/facebook/FacebookSdk$1.class...
processing com/facebook/FacebookSdk$2.class...
processing com/facebook/FacebookSdk$3.class...
processing com/facebook/FacebookSdk$4.class...
processing com/facebook/FacebookSdk$InitializeCallback.class...
processing com/facebook/FacebookSdkNotInitializedException.class...
processing com/facebook/FacebookSdkVersion.class...
processing com/facebook/FacebookServiceException.class...
processing com/facebook/GraphRequest.class...
processing com/facebook/GraphRequest$1.class...
processing com/facebook/GraphRequest$2.class...
processing com/facebook/GraphRequest$3.class...
processing com/facebook/GraphRequest$4.class...
processing com/facebook/GraphRequest$5.class...
processing com/facebook/GraphRequest$6.class...
processing com/facebook/GraphRequest$7.class...
processing com/facebook/GraphRequest$Attachment.class...
processing com/facebook/GraphRequest$Callback.class...
processing com/facebook/GraphRequest$GraphJSONArrayCallback.class...
processing com/facebook/GraphRequest$GraphJSONObjectCallback.class...
processing com/facebook/GraphRequest$KeyValueSerializer.class...
processing com/facebook/GraphRequest$OnProgressCallback.class...
processing com/facebook/GraphRequest$ParcelableResourceWithMimeType.class...
processing com/facebook/GraphRequest$ParcelableResourceWithMimeType$1.class...
processing com/facebook/GraphRequest$Serializer.class...
processing com/facebook/GraphRequestAsyncTask.class...
processing com/facebook/GraphRequestBatch.class...
processing com/facebook/GraphRequestBatch$Callback.class...
processing com/facebook/GraphRequestBatch$OnProgressCallback.class...
processing com/facebook/GraphResponse.class...
processing com/facebook/GraphResponse$PagingDirection.class...
processing com/facebook/HttpMethod.class...
processing com/facebook/LegacyTokenHelper.class...
processing com/facebook/LoggingBehavior.class...
processing com/facebook/Profile.class...
processing com/facebook/Profile$1.class...
processing com/facebook/Profile$2.class...
processing com/facebook/ProfileCache.class...
processing com/facebook/ProfileManager.class...
processing com/facebook/ProfileTracker.class...
processing com/facebook/ProfileTracker$1.class...
processing com/facebook/ProfileTracker$ProfileBroadcastReceiver.class...
processing com/facebook/ProgressNoopOutputStream.class...
processing com/facebook/ProgressOutputStream.class...
processing com/facebook/ProgressOutputStream$1.class...
processing com/facebook/RequestOutputStream.class...
processing com/facebook/RequestProgress.class...
processing com/facebook/RequestProgress$1.class...
processing com/facebook/TestUserManager.class...
processing com/facebook/TestUserManager$Mode.class...
ignored resource com/facebook/appevents/
processing com/facebook/appevents/AppEventsConstants.class...
processing com/facebook/appevents/AppEventsLogger.class...
processing com/facebook/appevents/AppEventsLogger$1.class...
processing com/facebook/appevents/AppEventsLogger$2.class...
processing com/facebook/appevents/AppEventsLogger$3.class...
processing com/facebook/appevents/AppEventsLogger$4.class...
processing com/facebook/appevents/AppEventsLogger$5.class...
processing com/facebook/appevents/AppEventsLogger$6.class...
processing com/facebook/appevents/AppEventsLogger$7.class...
processing com/facebook/appevents/AppEventsLogger$AccessTokenAppIdPair.class...
processing com/facebook/appevents/AppEventsLogger$AccessTokenAppIdPair$SerializationProxyV1.class...
processing com/facebook/appevents/AppEventsLogger$AppEvent.class...
processing com/facebook/appevents/AppEventsLogger$AppEvent$SerializationProxyV1.class...
processing com/facebook/appevents/AppEventsLogger$FlushBehavior.class...
processing com/facebook/appevents/AppEventsLogger$FlushReason.class...
processing com/facebook/appevents/AppEventsLogger$FlushResult.class...
processing com/facebook/appevents/AppEventsLogger$FlushStatistics.class...
processing com/facebook/appevents/AppEventsLogger$PersistedAppSessionInfo.class...
processing com/facebook/appevents/AppEventsLogger$PersistedAppSessionInfo$1.class...
processing com/facebook/appevents/AppEventsLogger$PersistedEvents.class...
processing com/facebook/appevents/AppEventsLogger$SessionEventsState.class...
processing com/facebook/appevents/FacebookTimeSpentData.class...
processing com/facebook/appevents/FacebookTimeSpentData$1.class...
processing com/facebook/appevents/FacebookTimeSpentData$SerializationProxyV1.class...
processing com/facebook/appevents/FacebookTimeSpentData$SerializationProxyV2.class...
ignored resource com/facebook/appevents/internal/
processing com/facebook/appevents/internal/ActivityLifecycleTracker.class...
processing com/facebook/appevents/internal/ActivityLifecycleTracker$1.class...
processing com/facebook/appevents/internal/ActivityLifecycleTracker$2.class...
processing com/facebook/appevents/internal/ActivityLifecycleTracker$3.class...
processing com/facebook/appevents/internal/ActivityLifecycleTracker$4.class...
processing com/facebook/appevents/internal/ActivityLifecycleTracker$4$1.class...
processing com/facebook/appevents/internal/Constants.class...
processing com/facebook/appevents/internal/SessionInfo.class...
processing com/facebook/appevents/internal/SessionLogger.class...
processing com/facebook/appevents/internal/SourceApplicationInfo.class...
processing com/facebook/appevents/internal/SourceApplicationInfo$1.class...
processing com/facebook/appevents/internal/SourceApplicationInfo$Factory.class...
ignored resource com/facebook/applinks/
processing com/facebook/applinks/AppLinkData.class...
processing com/facebook/applinks/AppLinkData$1.class...
processing com/facebook/applinks/AppLinkData$CompletionHandler.class...
processing com/facebook/applinks/FacebookAppLinkResolver.class...
processing com/facebook/applinks/FacebookAppLinkResolver$1.class...
processing com/facebook/applinks/FacebookAppLinkResolver$2.class...
ignored resource com/facebook/internal/
processing com/facebook/internal/AnalyticsEvents.class...
processing com/facebook/internal/AppCall.class...
processing com/facebook/internal/AppEventsLoggerUtility.class...
processing com/facebook/internal/AppEventsLoggerUtility$1.class...
processing com/facebook/internal/AppEventsLoggerUtility$GraphAPIActivityType.class...
processing com/facebook/internal/AttributionIdentifiers.class...
processing com/facebook/internal/AttributionIdentifiers$1.class...
processing com/facebook/internal/AttributionIdentifiers$GoogleAdInfo.class...
processing com/facebook/internal/AttributionIdentifiers$GoogleAdServiceConnection.class...
processing com/facebook/internal/BoltsMeasurementEventListener.class...
processing com/facebook/internal/BundleJSONConverter.class...
processing com/facebook/internal/BundleJSONConverter$1.class...
processing com/facebook/internal/BundleJSONConverter$2.class...
processing com/facebook/internal/BundleJSONConverter$3.class...
processing com/facebook/internal/BundleJSONConverter$4.class...
processing com/facebook/internal/BundleJSONConverter$5.class...
processing com/facebook/internal/BundleJSONConverter$6.class...
processing com/facebook/internal/BundleJSONConverter$7.class...
processing com/facebook/internal/BundleJSONConverter$Setter.class...
processing com/facebook/internal/CallbackManagerImpl.class...
processing com/facebook/internal/CallbackManagerImpl$Callback.class...
processing com/facebook/internal/CallbackManagerImpl$RequestCodeOffset.class...
processing com/facebook/internal/CollectionMapper.class...
processing com/facebook/internal/CollectionMapper$1.class...
processing com/facebook/internal/CollectionMapper$2.class...
processing com/facebook/internal/CollectionMapper$Collection.class...
processing com/facebook/internal/CollectionMapper$OnErrorListener.class...
processing com/facebook/internal/CollectionMapper$OnMapValueCompleteListener.class...
processing com/facebook/internal/CollectionMapper$OnMapperCompleteListener.class...
processing com/facebook/internal/CollectionMapper$ValueMapper.class...
processing com/facebook/internal/CustomTab.class...
processing com/facebook/internal/DialogFeature.class...
processing com/facebook/internal/DialogPresenter.class...
processing com/facebook/internal/DialogPresenter$ParameterProvider.class...
processing com/facebook/internal/FacebookDialogBase.class...
processing com/facebook/internal/FacebookDialogBase$ModeHandler.class...
processing com/facebook/internal/FacebookDialogFragment.class...
processing com/facebook/internal/FacebookDialogFragment$1.class...
processing com/facebook/internal/FacebookDialogFragment$2.class...
processing com/facebook/internal/FacebookRequestErrorClassification.class...
processing com/facebook/internal/FacebookRequestErrorClassification$1.class...
processing com/facebook/internal/FacebookRequestErrorClassification$2.class...
processing com/facebook/internal/FacebookRequestErrorClassification$3.class...
processing com/facebook/internal/FacebookWebFallbackDialog.class...
processing com/facebook/internal/FacebookWebFallbackDialog$1.class...
processing com/facebook/internal/FileLruCache.class...
processing com/facebook/internal/FileLruCache$1.class...
processing com/facebook/internal/FileLruCache$2.class...
processing com/facebook/interna<message truncated>
I guess it is due to the Support-v4 aar file. There are two copies of Support-v4 aar file in the project, when I had added google play games plugin and facebook sdk plugin. But when I try to remove any one of the aar file, the project is building successfully, but the plugins wont work at all. So is there any way to solve this issue.? Thanks in advance.
回答1:
Go to Assets->FacebookSDK->Plugins->Android->libs then delete android-support-v4.jar. There is a conflict there because it contains a class from another jar or aar file.
This problem was solved here too. If that did not solve your problem, create an empty project, import the facebook, and google plugins. Then zip and upload the project.
回答2:
To solve this problem:
- On your main Assets folder search on "support"
- Check for double support-annotations and also support-V4
- Look for older version
- Uncheck "Android" and click "Apply"
Done.
回答3:
I faced a similar problem. The general way for solving this is:
- In Windows Explorer, navigate to [project]\Assets.
- To list all the jar and aar files, in the top-right search box of Explorer, enter *.?ar
- Right-click anywhere to View as Details, and Sort by Name.
- Check for files with the same or similar names. Normally these are the same files, possibly of different versions.
- Delete the files of the older version.
Done!
For my case, the conflicting errors arose from Google Mobile Ads and Facebook SDK. I needed to delete two files:
Assets\FacebookSDK\Plugins\Android\libs\support-annotations-23.4.0.jar (deleted)
Assets\FacebookSDK\Plugins\Android\libs\support-v4-23.4.0.aar (deleted)
Assets\Plugins\support-annotations-24.0.0.jar
Assets\Plugins\support-v4-24.0.0.aar
回答4:
I did not find any duplicate plugins. Upgrading to JDK8 and pointing to it in Unity Preferences solved it for me.
回答5:
I had the same problem and resolved it by deleting the duplicate files with the older version in Google Play folder. You can see it in the image. I think It would help you.
来源:https://stackoverflow.com/questions/36910494/unable-to-convert-classes-into-dex-format-build-error-in-unity-5-3-4f1-when-goo