1

I am using facebook-unity-sdk-7.3.0 and GooglePlayGamesPlugin-0.9.32 in my project. it does not let me build for android and fails with error 'Unable to convert classes into dex format. See the Console for details.'. It starts working again when I delete any of the sdk fb or googleplay from my project.

Console error

CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details. /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/shoaib/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar"

and

Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details. /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/shoaib/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar"

I did some research on it and found that this issue is related to two same jar files in the project but in my project, I unable find any duplicate jar file.

Edited for reproducing the issue, I have made a sample project which can be downloaded from here http://wikisend.com/download/966354/LeaderboardTest.zip

Shoaib
  • 2,286
  • 1
  • 19
  • 27

4 Answers4

1

'Unable to convert classes into dex format. See the Console for details.'.

this one shows up when a class/dll exists twice in the project.

Often it happens when updating framework, if you do not remove the old version properly, then some classes may appear twice.

Since they are stored in plugins folder, Unity does not check them and they only show up in build process.

Best could be to remove everything related to both plugins and reimport them. That solved it for me when using UniWebView and Vuforia in same app. One of those was not properly updated.

Everts
  • 10,408
  • 2
  • 34
  • 45
  • Thanks @fafase! I did not upgrade the framework versions. I am doing fresh integration. For testing, I created a new project and imported facebook and google play sdk in my project. it produces the same error when building for android. you can see download link to the sample project with the issue. – Shoaib Apr 08 '16 at 06:28
  • Try reading this one, http://forum.unity3d.com/threads/unable-to-convert-classes-to-dex-format-android-issue.197061/ pretty much it is all about figuring out which jar is making things go wrong. It could be two jars with same name but not necessarily. – Everts Apr 08 '16 at 06:31
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.

Programmer
  • 121,791
  • 22
  • 236
  • 328
  • I am not getting "android-support-v4.jar." file in my folder but I'm getting the same error. – veeresh kumbar Oct 31 '17 at 12:31
  • This answer is old because FB plugin is now different. It likeyly uses the .aar plugin instead of jar so look for .aar plugin extension in the FaceBook SDK and delete it. Maybe that will work... – Programmer Oct 31 '17 at 15:14
  • can u please check this question https://stackoverflow.com/questions/46938647/unity-2017-2-0f3-with-facebook-7-10-1-build-error-formatexception-input-string – veeresh kumbar Nov 01 '17 at 13:25
0

In my case I could solve this problem by removing Android SDK Build-Tools version 24 and replacing it with version 23.

Payam Sh
  • 1
  • 1
0

Maybe it's too late to answer, I was facing the same issue, I created a plugin this plugin contains Facebook SDK+Admob+unityads +unity IAP, all of them work together, I've created this plugin in unity 5.6.0, but I've checked it, it is working fine in unity 2017 as well, there is a scene "DemoScene", just open it everything is implemented, unity ads, admob, facebook share with callback, unityIAP.

Note: before importing the plugin kindly delete all the old plugins, also go to services and turn on unity ads. http://www.mediafire.com/file/ccvj7ixir8ive25/FB_ADMOB_UnityIAP_UnityAds_Plugin_Hameed_Ullah_jan.unitypackage