googlesamples / google-signin-unity

Google Sign-In API plugin for Unity game engine. Works with Android and iOS.
Other
402 stars 221 forks source link

DllNotFoundException: Unable to load DLL 'native-googlesignin': The specified module could not be found. #106

Open tonyjoseph456 opened 4 years ago

tonyjoseph456 commented 4 years ago

Im getting an error when trying to signin with Google using the google-signin-unity plugin. its showing like this in the logcat errors:

E Unity : Unable to find native-googlesignin 08-30 12:21:52.746 29663 29706 E Unity : DllNotFoundException: Unable to load DLL 'native-googlesignin': The specified module could not be found. 08-30 12:21:52.746 29663 29706 E Unity : at Google.Impl.GoogleSignInImpl.GoogleSignIn_Create (System.IntPtr data) [0x00000] in <00000000000000000000000000000000>:0 08-30 12:21:52.746 29663 29706 E Unity : at Google.Impl.GoogleSignInImpl..ctor (Google.GoogleSignInConfiguration configuration) [0x00000] in <00000000000000000000000000000000>:0 08-30 12:21:52.746 29663 29706 E Unity : at Google.GoogleSignIn.get_DefaultInstance () [0x00000] in <00000000000000000000000000000000>:0 08-30 12:21:52.746 29663 29706 E Unity : at SplashScene.SignInWithGoogle () [0x00000] in <00000000000000000000000000000000>:0 08-30 12:21:52.746 29663 29706 E Unity : at UnityEngine.Events.UnityEvent.Invoke () [0x00000] in <00000000000000000000000000000000>:0 08-30 12:21:52.746 29663 29706 E Unity : at UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchPress (UnityEngine.EventSystems.PointerEventData pointerEvent, System.Boolean pressed, System.Boolean released) [0x00000] in <00000000000000000000000000000000>:0 08-30 12:21:52.746 29663 29706 E Unity : at UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchEvents () [0x00000] in <00000000000000000000000000000000>:0 08-30 12:21:52.746 29663 29706 E Unity : at UnityEngine.

Can someone please help me in fixing this issue. We are having trouble in releasing our project due to this issue

Mukikaizoku commented 4 years ago

Hi @tonyjoseph456 , I might be able to help--I think the Unable to find native-googlesignin issue comes from the inability to load the google-signin-support .aar.

From my understanding, the Unity package does not come with a usable .aar. Due to (I believe a workaround) within the build process, the .aar file is renamed with the .srcaar file extension. I had to manually remove the "src" from 6 files.

Navigate within your project to ..\Assets\GoogleSignIn\Editor\m2repository\com\google\signin\google-signin-support\1.0.4.

You should see these files: image

Change all file extensions with .srcaar to .aar (don't change the rest of the extension).

After that, go to your project in Unity and select the .aar file. You'll need to include the platforms you are using the app on. image

For me, I checked the Android box then hit apply.

Now that you have the .aar, you can import its dependencies. Run the Play Services Resolver. If it worked there should be a bunch of .jar files within ..\Plugins\Android\.

Hope that helps!

tonyjoseph456 commented 4 years ago

@Mukikaizoku After renaming it to .aar, the play services resolver fails to resolve by giving the following error:


Resolution failed

Failed to fetch the following dependencies:
com.google.signin:google-signin-support:1.0.4
Patomanriquezb commented 4 years ago

Hi @tonyjoseph456 , I might be able to help--I think the Unable to find native-googlesignin issue comes from the inability to load the google-signin-support .aar.

From my understanding, the Unity package does not come with a usable .aar. Due to (I believe a workaround) within the build process, the .aar file is renamed with the .srcaar file extension. I had to manually remove the "src" from 6 files.

Navigate within your project to ..\Assets\GoogleSignIn\Editor\m2repository\com\google\signin\google-signin-support\1.0.4.

You should see these files: image

Change all file extensions with .srcaar to .aar (don't change the rest of the extension).

After that, go to your project in Unity and select the .aar file. You'll need to include the platforms you are using the app on. image

For me, I checked the Android box then hit apply.

Now that you have the .aar, you can import its dependencies. Run the Play Services Resolver. If it worked there should be a bunch of .jar files within ..\Plugins\Android\.

Hope that helps!

worked for me, thanks!

Zhm17 commented 3 years ago

worked for me, as well, :D thx!

kimsin3003 commented 3 years ago

Should I check dependency for ios if i need google signin in ios? Or is aar file used just for android?

mgulatichicmic commented 3 years ago

The above solution is not working for me. Any other suggestion?

ArkTarusov commented 1 year ago

If the error persists after performing the steps described above, then you can force the library to be imported into apk.

For this:

image image2

The problem is most likely related to strong obsolescence of this repository. The library relies on a heavily deprecated unity-jar-resolver. Which, in principle, does not work in new versions of the Unity.

The latest version of unity-jar-resolver probably makes some kind of mistake when importing this library.

Two years ago, I successfully resolved dependencies using the then unity-jar-resolver, this time apparently something has changed a lot.

We have a firebase crashlytics in our project, which successfully resolves dependencies. I tried to find the differences until I could. Maybe later I will try again to solve the problem with the unity-jar-resolver, or maybe someone else will do it and write about it in this discussion.

grayby commented 1 year ago

Hey reader! If you already tried all the solutions described above and still getting 'Unable to load native-googlesignin' then try to use a different device with a different CPU architecture or swtich the architecture on your AVD/virtual machine. After digging into the AAR archive I found that the default AAR file compilation approach does not provide the code for x86-64 CPU architecture that I`ve been using on my AVD

In case everything works properly after architecture change the recompilation of plugin is most probably required

@mgulatichicmic

ToterKojote commented 1 year ago

If none of the previous mentioned solutions worked for you try the following (Worked in my case):

  1. Delete the file "\\ProjectSettings\AndroidResolverDependencies.xml" (It will be recreated later when resolving the Android dependencies)

  2. Delete the asset folders that came from the google sign in and unity jar resolver packages ("ExternalDependencyManager", "GoogleSignin", "Plugins")

  3. Delete the current build (the .apk file of your app)

  4. Reimport the unity packages (external-dependency-manager (https://github.com/googlesamples/unity-jar-resolver) and the google-signin-plugin)

  5. Resolve Android Dependencies (Assets -> External Dependency Manager -> Android Resolver -> Resolve)

  6. Perform a CLEAN build (In Build Settings click the little arrow next to the "Build"-Button and choose "Clean Build". This forces a rebuild of the Library folder.)

  7. Test...and hope that it works

Im actually not sure which step did the trick here but I hope this will work for you too :-)

pogsdbest commented 1 year ago

If none of the previous mentioned solutions worked for you try the following (Worked in my case):

  1. Delete the file "\ProjectSettings\AndroidResolverDependencies.xml" (It will be recreated later when resolving the Android dependencies)
  2. Delete the asset folders that came from the google sign in and unity jar resolver packages ("ExternalDependencyManager", "GoogleSignin", "Plugins")
  3. Delete the current build (the .apk file of your app)
  4. Reimport the unity packages (external-dependency-manager (https://github.com/googlesamples/unity-jar-resolver) and the google-signin-plugin)
  5. Resolve Android Dependencies (Assets -> External Dependency Manager -> Android Resolver -> Resolve)
  6. Perform a CLEAN build (In Build Settings click the little arrow next to the "Build"-Button and choose "Clean Build". This forces a rebuild of the Library folder.)
  7. Test...and hope that it works

Im actually not sure which step did the trick here but I hope this will work for you too :-)

this one worked for me

AlmightyMikkel commented 6 months ago

Hey there :) I hope someone could help me out here as I've had the same issue, but when opening the path, I am met with an empty folder where the .aar and .pom files should appear? image EDIT: They appear to be gone when just installing the .zip, if I get it from unitypackage it's there :)

Jove125 commented 4 months ago

Now Google Play requires a mandatory assembly for target Arm64 architecture (previously, you could make an assembly just for Armv7 and use it on Arm64). But this *.so libraries doesn't built and not included in this repository - it hasn't been updated for over 6 years.

I built it, you can download it here: https://github.com/googlesamples/google-signin-unity/issues/234