Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Facebook plugin and Unity 5.1.1 bug

Discussion in 'Android' started by Destrankir, Jul 15, 2015.

  1. Destrankir

    Destrankir

    Joined:
    Apr 17, 2015
    Posts:
    21
    I tried this versions 6.2.2, 7.0.1, 7.0.2 on my unity 5.1.1 and I get errors in all when I build that in android.
    (I have aswell soomla,photon, charboost and google play services)

    Any idea?

    In the 6.2.2 I get "unable to convert files into dex format"

    errors:

    1.
    CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.

    C:\Program Files\Java\jdk1.7.0_17\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Program Files (x86)/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" - stderr[ UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Landroid/support/v4/util/TimeUtils; ets..

    2.
    Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.

    C:\Program Files\Java\jdk1.7.0_17\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Program Files (x86)/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" - stderr[ UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Landroid/support/v4/util/TimeUtils; at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122) at com.android.dx.dex.file.DexFile.add(DexFile.java:161) at

    ets..

    In the 7.0.2 I get "unable to convert classes into dex format"

    1.
    CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
    C:\Program Files\Java\jdk1.7.0_17\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Program Files (x86)/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -


    2.
    Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
    C:\Program Files\Java\jdk1.7.0_17\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Program Files (x86)/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    Already added: Landroid/support/v4/util/TimeUtils; ets..

    You probably include the Android support library more than once in your Unity project.

    Look for any duplicate .jar files and eliminate them so that only 1 is left.
     
    Destrankir likes this.
  3. Destrankir

    Destrankir

    Joined:
    Apr 17, 2015
    Posts:
    21
    "You probably include the Android support library more than once in your Unity project."
    how do I know that?

    I search for jar files in my Unity project folder and I checked and deleted any duplicate jar files but it happens the same

    thanks
     
  4. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    Unity doesn't allow searching for file extensions from the editor, are you searching through Windows explorer / Finder (on Mac) ?

    Also, it's possible that if you have any 3rd party .jar libraries, some of these may have been built to include the google support library inside, so that can also cause this issue (the same classes are being included twice in your final game package).

    Could you send out a complete list of .JARs in your project (with their sizes to see whether they could potentially include other libraries inside them).
     
    Destrankir likes this.
  5. Destrankir

    Destrankir

    Joined:
    Apr 17, 2015
    Posts:
    21
    like that?
     

    Attached Files:

  6. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    You have so many JARs :)

    I can see android-support-v4 and android-support-v5, these seem to be 2 versions of the same thing. They *may* contain the same set of classes... not really sure. Why do you need both of them ?
     
    Destrankir likes this.
  7. Destrankir

    Destrankir

    Joined:
    Apr 17, 2015
    Posts:
    21
    Thanks I deleted support-v4 and I can build it now !!

    but when I open the game it closes xD i need to try more thing
     
  8. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    Good to know you resolved the original issue. This sounds like something else.

    Did you try to retrieve the logcat output to see what's causing the game to crash?
     
  9. Destrankir

    Destrankir

    Joined:
    Apr 17, 2015
    Posts:
    21
    Hey, I try to just add the login things in facebook:
    It works in the editor show me the token and log in but when I do that in the phone nothing happens.


    "
    using UnityEngine;
    using System.Collections;

    public class FBArnau : MonoBehaviour {


    void Awake () {
    FB.Init (SetInit);
    }
    private void SetInit()
    {
    Debug.Log("FB init done");
    if (FB.IsLoggedIn){
    Debug.Log("FB log in");
    }
    else{
    FBLogin();
    }
    }

    public void FBLogin()
    {
    FB.LogInWithPublishPermissions("email,publish_actions", AuthCallback);
    }
    void AuthCallback(FBResult result)
    {
    if(FB.IsLoggedIn){
    Debug.Log("FB loging working");
    }else{
    Debug.Log ("FB loging fail");
    }
    }
    }
    "

    Console errors:

    1
    You cannot show two modal windows at once
    UnityEngine.GUI:ModalWindow(Int32, Rect, WindowFunction, String)
    EditorFacebookAccessToken:OnGUI() (at Assets/Facebook/Scripts/PlatformEditor/EditorFacebookAccessToken.cs:22)
    2
    ArgumentException: Getting control 0's position in a group with only 0 controls when doing Repaint
    Aborting
    UnityEngine.GUILayoutGroup.GetNext () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/GUILayoutUtilityBindings.gen.cs:511)
    UnityEngine.GUILayoutUtility.DoGetRect (Single minWidth, Single maxWidth, Single minHeight, Single maxHeight, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at

    facebook settings - anddroid build facebook settings - Warning:
    OpenSLL not found. Make sure OpenSLL is intalled and that it is in your path.
     
  10. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,559
    Is this error something that you are printing, or do you think this is coming from the Facebook plugin ? which version of the Facebook SDK are you using ?
     
  11. Destrankir

    Destrankir

    Joined:
    Apr 17, 2015
    Posts:
    21
    Its from facebook I'm using facebook 7.0.2 on my unity 5.1.1
     

    Attached Files:

  12. Who-am-I

    Who-am-I

    Joined:
    Mar 29, 2014
    Posts:
    73
    I have same issue and i am using unity 5.2.3 with facebook latest SDK.