Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You get Unable to convert classes into dex format. #4

Open
clivehenrick opened this issue Oct 31, 2017 · 12 comments
Open

You get Unable to convert classes into dex format. #4

clivehenrick opened this issue Oct 31, 2017 · 12 comments

Comments

@clivehenrick
Copy link

CommandInvokationFailure: Unable to convert classes into dex format.
/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/chenrick/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/googlesignin/GoogleSignInFragment;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/googlesignin/GoogleSignInFragment$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/googlesignin/GoogleSignInFragment$2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/googlesignin/GoogleSignInFragment$3;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/googlesignin/GoogleSignInFragment$State;
Uncaught translation error: java.lang.IllegalArgumentException:

@claywilkinson
Copy link
Contributor

This looks like you might have multiple versions or copies of the google-signin-support.aar? Can you share the contents of Assets/Plugins/Android?

@clivehenrick
Copy link
Author

Hello! I went back and tried this step by step following of your build instructions and I now get this when I try and Build and Deploy:

CommandInvokationFailure: Gradle build failed.
/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java -classpath "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-2.14.jar" org.gradle.launcher.GradleMain "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':processReleaseResources'.

Error: more than one library with package name 'com.google.nativelib.googlesignin'

GoogleOathUnityPlugin_StepByStep_v1.pdf

@clivehenrick
Copy link
Author

Next step is

NEXT STEP:

Went to the Build Settings and Picked Internal instead of Gradle.

Get an Error:

Resolution failed

Failed to fetch the following dependencies:
com.google.signin:google-signin-support:1+@aar

UnityEngine.Debug:LogError(Object)
Google.Logger:Log(String, LogLevel)
GooglePlayServices.PlayServicesResolver:Log(String, LogLevel)
GooglePlayServices.ResolverVer1_1:LogMissingDependenciesError(List1) GooglePlayServices.<DoResolutionUnsafe>c__AnonStorey18:<>m__26(List1)
GooglePlayServices.c__AnonStorey14:<>m__1F(Result)
GooglePlayServices.c__AnonStorey15:<>m__28()
GooglePlayServices.PlayServicesResolver:PumpUpdateQueue()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

Go to the Plugin Play Services Resolver > Android > Resolve

“Says Complete”

Go to the Build Settings Menu and Build and Run

Looks like it builds and Deploys. I am on slack by the way, and happy to trouble shoot all of this if there is a faster way.

@claywilkinson
Copy link
Contributor

Thanks for the details!

I think the problem is Assets/Plugins/Android/native-googlesignin-release.aar This was the library from the 1.0.0 version of the plugin, but it is no longer used in 1.1
Apparently it got into the build. I'll take a look at it today and fix the unitypackage.

@clivehenrick
Copy link
Author

Glad to here a new version coming out:

So I am now going through next steps and having some issues once I switched to internal Build in Unity.

NEXT STEP:

Went to the Build Settings and Picked Internal instead of Gradle.

Get an Error:

Resolution failed

Failed to fetch the following dependencies:
com.google.signin:google-signin-support:1+@aar

UnityEngine.Debug:LogError(Object)
Google.Logger:Log(String, LogLevel)
GooglePlayServices.PlayServicesResolver:Log(String, LogLevel)
GooglePlayServices.ResolverVer1_1:LogMissingDependenciesError(List1) GooglePlayServices.<DoResolutionUnsafe>c__AnonStorey18:<>m__26(List1)
GooglePlayServices.c__AnonStorey14:<>m__1F(Result)
GooglePlayServices.c__AnonStorey15:<>m__28()
GooglePlayServices.PlayServicesResolver:PumpUpdateQueue()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

Go to the Plugin Play Services Resolver > Android > Resolve

“Says Complete”

Go to the Build Settings Menu and Build and Run

Works

Go to the App on Android Device and you get an Error when you sign in, but that is expected as I need to go to the Firebase Authentication Panel and Add Google Sign In.

So after I enabled Google Oath in Firebase Panel, still get errors in the android App when trying to signing.

So I when to the Scene and then Remembered that I needed to add the webclientID to the SiginIn Sample Script Attached to the Canvas. I would recommend that you remind people to do this step in your docs before the build.

@clivehenrick
Copy link
Author

And Once I added the WebClientId to the Script it worked!!!! ( With Internal Build ). Now to add the Firebase flow (which is what I really am looking for ).

@clivehenrick
Copy link
Author

So to add the FireBase Oath , I assume that you need to install the Firebase.oath Package for Unity as its using the FirebaseUser class.

@claywilkinson
Copy link
Contributor

Right - What I did was download the Firebase SDK zip file with all the unity packages, then imported the ones I wanted to use, and follow the instructions to add the google-services.json file to the project.

@clivehenrick
Copy link
Author

So i changed the class to add the firebase oath flow and it crashes on the android device.
Steps:
Adding the FireBase Scripts to the Sample Code

You need to add the Firebase Oath Package

FirebaseAuth.unitypackage

So you add the package to the Project and get no warnings.

Changes to the Script for FireBase Oath

Builds

I have attached the script for feedback if you have any time.
SigninSampleScript copy.txt

@clivehenrick
Copy link
Author

So after todays debugging, I realised that you need to add the Firebase init into your code.

void Awake() {
configuration = new GoogleSignInConfiguration {
WebClientId = webClientId,
RequestIdToken = true
};

//Start Firebase
auth = Firebase.Auth.FirebaseAuth.DefaultInstance;

}

It should more or less work correctly. If you would like I can send you the finished code that you are welcomed to use. Thank you the Project, as it solves a big piece of what has made this whole google Oath so painful for Unity Developers.

@clivehenrick
Copy link
Author

As another note, There is no error that is generated in Unity if FireBase is not initialized correctly. The App will just crash in Android, so the only way to discover the issue was to use the normally adb while watching the Android stack trace and hunt for the message, which for Unity developers, is not what they are expecting.

While you are doing a fantastic job at this project (and again thank you so much for doing this SDK) please remember that Unity Developers are in general not up to the same level of software development that you as an Android Expert are used to. They will need to be spoon feed the steps and please think about giving actual completed code when ever possible. Any time you mention "Look at iOS or Android" I believe there eye's will sort of get large and they might panic a bit.

@claywilkinson
Copy link
Contributor

Thanks for the feedback! I am happy to integrate changes to make things more clear! The sample snippet is definitely out of context - I copied from the testapp from the Quickstart sample for Firebase.

Feel free to submit pull requests, especially for documentation if you think it makes it more clear and helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants