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

HMS Unity not working , create run time error (v2.3.5 - Unity 2019/2020/2021) #465

Closed
breaksoftdev opened this issue Feb 5, 2024 · 12 comments
Assignees
Labels
help wanted Extra attention is needed timeout and closed A month passed after the solution was given.

Comments

@breaksoftdev
Copy link

We are trying to use the HMS Unity plugin for Huawei AppGallary. but it's not working, we tried all the methods and it's not shown in test mode, when we run the code it creates an error on the start screen.
please review the mentioned error

Exception: Field currentActivity or type signature not found
UnityEngine._AndroidJNIHelper.GetFieldID (System.IntPtr jclass, System.String fieldName, System.String signature, System.Boolean isStatic) (at :0)
UnityEngine.AndroidJNIHelper.GetFieldID (System.IntPtr javaClass, System.String fieldName, System.String signature, System.Boolean isStatic) (at :0)
UnityEngine._AndroidJNIHelper.GetFieldID[ReturnType] (System.IntPtr jclass, System.String fieldName, System.Boolean isStatic) (at :0)
UnityEngine.AndroidJNIHelper.GetFieldID[FieldType] (System.IntPtr jclass, System.String fieldName, System.Boolean isStatic) (at :0)
UnityEngine.AndroidJavaObject._GetStatic[FieldType] (System.String fieldName) (at :0)
UnityEngine.AndroidJavaObject.GetStatic[FieldType] (System.String fieldName) (at :0)
HuaweiMobileServices.Utils.AndroidContext.get_ActivityContext () (at <3e917abcbb924450a121c615facfe546>:0)
HuaweiMobileServices.Ads.HwAds.Init () (at <3e917abcbb924450a121c615facfe546>:0)
HmsPlugin.HMSAdsKitManager.Init () (at Assets/Huawei/Scripts/Ads/HMSAdsKitManager.cs:71)
HmsPlugin.HMSAdsKitManager.OnAwake () (at Assets/Huawei/Scripts/Ads/HMSAdsKitManager.cs:57)
HuaweiMobileServices.Utils.HMSDispatcher.InvokeAsync (System.Action action) (at <3e917abcbb924450a121c615facfe546>:0)
HmsPlugin.HMSAdsKitManager..ctor () (at Assets/Huawei/Scripts/Ads/HMSAdsKitManager.cs:50)
System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) (at <4a4789deb75f446a81a24a1a00bdd3f9>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) (at <4a4789deb75f446a81a24a1a00bdd3f9>:0)
System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic, System.Boolean wrapExceptions) (at <4a4789deb75f446a81a24a1a00bdd3f9>:0)
System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean wrapExceptions, System.Boolean skipCheckThis, System.Boolean fillCache) (at <4a4789deb75f446a81a24a1a00bdd3f9>:0)
System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Boolean wrapExceptions, System.Threading.StackCrawlMark& stackMark) (at <4a4789deb75f446a81a24a1a00bdd3f9>:0)
System.Activator.CreateInstance[T] () (at <4a4789deb75f446a81a24a1a00bdd3f9>:0)
HMSManagerSingleton1[T].get_Instance () (at Assets/Huawei/Scripts/Utils/HMSSingleton.cs:53) AdsDemoManager.ShowBannerAd () (at Assets/Huawei/Demos/Ads/AdsDemoManager.cs:83) AdsUIView.ButtonClick_ShowBannerAd () (at Assets/Huawei/Demos/Ads/AdsUIView.cs:67) UnityEngine.Events.InvokableCall.Invoke () (at <f712b1dc50b4468388b9c5f95d0d0eaf>:0) UnityEngine.Events.UnityEvent.Invoke () (at <f712b1dc50b4468388b9c5f95d0d0eaf>:0) UnityEngine.UI.Button.Press () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:70) UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Button.cs:114) UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:57) UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:272)
UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:514)

Copy link

github-actions bot commented Feb 5, 2024

Thank you for reporting this issue/advice.

We will get back to you as soon as possible.
Would you like to star our plugin to support us? ✨

@alihan98ersoy
Copy link
Collaborator

Hello, you should try the plugin with a real device. Huawei recommended. Also, you can use any Android device with HMS Core installed. If you don't have an Android device you can use Cloud Debugging.

@alihan98ersoy alihan98ersoy added help wanted Extra attention is needed and removed new labels Feb 5, 2024
@breaksoftdev
Copy link
Author

yes, we tried the APK on Cloud Debugging, even it's not running in Unity, it created the error, we have already mentioned the error when it run in the Unity Editore.

@alihan98ersoy
Copy link
Collaborator

Can you provide the logs from CloudDebugging ? I need the check the logs

@breaksoftdev
Copy link
Author

breaksoftdev commented Feb 7, 2024

please the all details with logs
Screenshot (20)

2024-02-07 19_41_13.log

@alihan98ersoy
Copy link
Collaborator

I couldn't find any log related with unity or our plugin. Did you use any filter? It should be something like this one
resim

If you want you can sent me your APK and I can test. You can send here or email me alihan98ersoy@hotmail.com

@breaksoftdev
Copy link
Author

@alihan98ersoy, please review the email.

I couldn't find any log related with unity or our plugin. Did you use any filter? It should be something like this one resim

If you want you can sent me your APK and I can test. You can send here or email me alihan98ersoy@hotmail.com

@alihan98ersoy
Copy link
Collaborator

@breaksoftdev I asked for permission to download the APK.

@alihan98ersoy
Copy link
Collaborator

Ok, I found the problem you should use your agconnect-services.json File.

Please refer to Obtaining the agconnect-services.json File
or the video.

Also, there are some errors "Error Unity InvalidOperationException: Insecure connection not allowed" I believe you missed the step on quick start. Adding Fingerprint Certificate to AppGallery Connect Can you follow the quick start?

@alihan98ersoy alihan98ersoy added the waiting for confirmation The solution has been given label Feb 9, 2024
@breaksoftdev
Copy link
Author

breaksoftdev commented Feb 9, 2024

@alihan98ersoy i followed all the steps as you mentioned in the video, but when we enabled the test ads and ran on the cloud debugging, it's not show the ads. even it creates errors in the unity editor, and shoe script errors (signature not found) it's possible, can you share the project/repo with working ads.

Ok, I found the problem you should use your agconnect-services.json File.

Please refer to Obtaining the agconnect-services.json File or the video.

Also, there are some errors "Error Unity InvalidOperationException: Insecure connection not allowed" I believe you missed the step on quick start. Adding Fingerprint Certificate to AppGallery Connect Can you follow the quick start?

@alihan98ersoy
Copy link
Collaborator

alihan98ersoy commented Feb 9, 2024

The package of agconnect-services.json in your APK was com.refapp.cubesurfer.huawei. This is the same json that we loaded into the plugin as an example.

  1. First, create a project with your own package name in the AppGallery console.
  2. Enable ads kit. (Requires Merchant permission)
  3. Then add your fingerprint. (SHA-256)
  4. Download agconnect-services.json and replace it.

If you use our JSON you will connect your game to our project but you don't have the same fingerprint so it will give a 6003 fingerprint error.

These are the APK:
AdsDemoTest.zip

@alihan98ersoy alihan98ersoy added timeout and closed A month passed after the solution was given. and removed waiting for confirmation The solution has been given labels Feb 21, 2024
Copy link

Thank you for using our repository! We're glad we could help solve your issue. If you found our repository helpful, please consider giving us a star ⭐ on GitHub: https://github.com/EvilMindDevs/hms-unity-plugin

Your support helps us continue to improve our repository and provide valuable resources for others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed timeout and closed A month passed after the solution was given.
Projects
None yet
Development

No branches or pull requests

2 participants