EvilMindDevs / hms-unity-plugin

The HMS Unity Plugin makes it easy to include Huawei Mobile Services into Unity-based games. Authentication, in-app purchases, push alerts, ads, and interaction with gaming services are just a few of the basic capabilities that this formidable tool makes available to your applications.
https://evilminddevs.gitbook.io/hms-unity-plugin/
305 stars 41 forks source link

Issue installing Huawei Android dependencies #493

Closed BigGiantHead closed 1 month ago

BigGiantHead commented 1 month ago

Unity editor version: 2022.3.28f1 External Dependency Manager version: 1.2.179 Source you installed EDM4U: .unitypackage (.unitypackage or Unity Package Manager) Features in External Dependency Manager in use: Android Resolver (Android Resolver, iOS Resolver, VersionHandler, etc.) Plugins SDK in use: Empty test project (Firebase, Admob, Facebook, etc.) Platform you are using the Unity editor on: Mac (Mac, Windows, or Linux)

I created an xml file for the External Dependency Manager that should resolve the dependencies for Android for your Huawei package. Everything works fine except that, even in an empty project, I have to have Jetiffier turned on, and I am getting the following Gradle error:

* Where:
Build file '/Users/ivanivanovski/Projects/TroposAR/HuaweiTest/Temp/PlayServicesResolverGradle/PlayServicesResolver.scripts.download_artifacts.gradle' line: 1025

* What went wrong:
Execution failed for task ':process_com.android.tools.build.bundletool-0.13.2.jar'.
> com.android.tools.build.jetifier.processor.transform.bytecode.AmbiguousStringJetifierException: The given artifact contains a string literal with a package reference 'android.support.design.widget' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.

I am not really sure how to solve this since it also happens in a completely empty project. Here are the settings that I have for External Dependency Manager: Screenshot 2024-05-13 at 15 04 01

Thank you for your help.

github-actions[bot] commented 1 month ago

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? :sparkles:

Andronovo-bit commented 1 month ago

Hi @BigGiantHead. There are steps you need to do before and after importing the plugin. If you do not perform these steps, you will get an error even if the project is empty.

Can you perform the steps by following the link below?

https://evilminddevs.gitbook.io/hms-unity-plugin/getting-started/quick-start

BigGiantHead commented 1 month ago

I already registered our project and copied the agconnect file. I don't really want to use that last step because I want to initialise it through code.

BigGiantHead commented 1 month ago

The problem arises when I make a build on Android. It either doesn't resolve the libraries and the app crashes, or I use External Dependency Manager and it simply doesn't work for the android dependencies.

BigGiantHead commented 1 month ago

@Andronovo-bit I made it work as per your instructions. When I make a build on my Huawei P30 Pro I am getting this error in the terminal:

05-13 16:51:03.405 15918 15956 E Unity : InvalidOperationException: Failed to load the HMSIAPKitSettings. Please restart Unity Editor 05-13 16:51:03.405 15918 15956 E Unity : at HmsPlugin.HMSIAPKitSettings..ctor () [0x00000] in <00000000000000000000000000000000>:0 05-13 16:51:03.405 15918 15956 E Unity : at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00000] in <00000000000000000000000000000000>:0 05-13 16:51:03.405 15918 15956 E Unity : at System.Activator.CreateInstance[T] () [0x00000] in <00000000000000000000000000000000>:0 05-13 16:51:03.405 15918 15956 E Unity : at HmsPlugin.HMSEditorSingleton`1[T].get_Instance () [0x00000] in <00000000000000000000000000000000>:0 05-13 16:51:03.405 15918 15956 E Unity : at HmsPlugin.HMSIAPManager.InitControlOfIAP () [0x00000] in <00000000000000000000000000000000>:0 05-13 16:51:03.405 15918 15956 E Unity : at HuaweiMobileServices.Utils.HMSDispatcher.InvokeAsync (System.Action action) [0x00000] in <00000000000000000000000000000000>:0 05-13 16:51:03.405 15918 15956 E Unity : at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00000] in <00000000000000000000000000000000>:0 05-13 16:51:03.405 15918 15956 E Unity : at System.Activator.C

How do I go around this issue?

BigGiantHead commented 1 month ago

@Andronovo-bit I turned off Initialize on Start and now I am getting

05-13 17:01:34.009 16969 17043 E Unity : [HMSException]: FAQ => The below 6003 error is caused by inconsistent certificate fingerprint configurations. Please check https://evilminddevs.gitbook.io/hms-unity-plugin_/support/faq#what-should-i-do-if-a-6003-error-occurs for more information. 05-13 17:01:34.009 16969 17043 E Unity : HmsPlugin.HMSIAPManager:b__69_1(HMSException) 05-13 17:01:34.009 16969 17043 E Unity : HuaweiMobileServices.Utils.HMSDispatcher:Update()

What does this mean exactly? That anchor doesn't exist on the page.

Andronovo-bit commented 1 month ago

@BigGiantHead Did you activate the plugin and kit that you want to use?

image

Can you look this link for 6003 error ?

https://evilminddevs.gitbook.io/hms-unity-plugin/support/faq/build-and-development#what-should-i-do-if-a-6003-error-occurs

BigGiantHead commented 1 month ago

image

yes I activated IAP. Let me check the link.

Andronovo-bit commented 1 month ago

Also, you can follow guide this IAP guide.

https://evilminddevs.gitbook.io/hms-unity-plugin/kits-and-services-and-features/hms-core/in-app-purchases/guides-and-references

BigGiantHead commented 1 month ago

Looks like the problem was that I had to add my account as tester account on AppGallery.

BigGiantHead commented 1 month ago

@Andronovo-bit managed to make this work. Thanks for your help. My setup was missing a few things on AppGallery.

github-actions[bot] commented 1 month ago

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.