Unable to build for android with facebook sdk and

2019-03-02 13:14发布

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

4条回答
唯我独甜
2楼-- · 2019-03-02 13:27

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

查看更多
祖国的老花朵
3楼-- · 2019-03-02 13:36

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.

查看更多
我只想做你的唯一
4楼-- · 2019-03-02 13:44

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

查看更多
手持菜刀,她持情操
5楼-- · 2019-03-02 13:49

'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.

查看更多
登录 后发表回答