Search Unity

Question Huawei Game Services rant and question

Discussion in 'Unity Distribution Portal (UDP)' started by iB_Gaming, Dec 29, 2020.

  1. iB_Gaming

    iB_Gaming

    Joined:
    Apr 13, 2020
    Posts:
    10
    Hi,

    I wanted to tell you a little Christmas story, as well as leave something for who might be googling this later.

    About two weeks ago, I got around to adapting my little Unity mobile game for release on Huawei App Gallery, willing to take advantage of their joint holiday promotion with Unity Distribution Portal. (The link is no longer accessible, it ran until December 24th.) All I needed to do is replace Google services with their Huawei counterparts - cloud saving and leaderboards. “A quick detour, few days of work”, I thought. As usual with estimating time for integrating whatever third-party service, I was wrong.

    The Unity integration guide is a complete mess with barely any information. Googling things doesn’t really work, as no one seems to have integrated Huawei Game Services in their Unity games before. Huawei’s services aren’t as simple and convenient as they try to look – you cannot store game data in the cloud all over the world, for example, you need to create different app versions for that. End result – I still can’t get everything to work, the promotion deadline is through, I’ve wasted two weeks instead of working on a content update for my game, Unity support has been silent for 6 days. Woohoo.

    For posterity, here are some obstacles I’ve overcome:

    InjectTool Inject failed: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

    It stemmed from the script called AddCustomTrace.cs located in the apm folder under HuaweiService. Since "apm" must stand for Application Performance Management, and it’s one of the numerous Huawei services I’m not aiming to use, I just went into the script and commented out all the method contents. I suppose removing the apm folder entirely could also work.

    Execution failed for task ':launcher:processDebugResources'. > Android resource linking failed error: resource style/Theme.AppCompat.Light.DarkActionBar (aka com.ibgames.the8.huawei:style/Theme.AppCompat.Light.DarkActionBar) not found.

    This meant that the app lacks Google’s appcompat library. For whatever reason, its necessity is not mentioned in any of the guides. To get around, add the following:
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    to your mainTemplate.gradle file.

    Another thing not mentioned in the guide, but present in the example GitHub is that you need to add the following line:
    apply plugin:
    'com.huawei.agconnect'
    to both your mainTemplate and launcherTemplate.gradle files for pretty much anything to work.

    Hope it helps someone. In the meantime, if anyone has an example of a working cloud saving script, I'd appreciate it, GetSnapshotDataList doesn't fire the callback for whatever reason in my project.
     
  2. Unity-Boon

    Unity-Boon

    Unity Technologies

    Joined:
    Jan 18, 2017
    Posts:
    135
  3. karyll

    karyll

    Joined:
    Apr 4, 2017
    Posts:
    50
    May I ask why did you need to replace the Google Services with Huawei ones? I have Google Achievements, Leaderboard and saving data to Google Play Games in my Huawei published game and it works just fine as the Google Play version.
     
  4. iB_Gaming

    iB_Gaming

    Joined:
    Apr 13, 2020
    Posts:
    10
    I'll take a look, thanks.


    If I understand it correctly, Google and its services are banned in mainland China, and I wanted to release there, so I thought I'd replace them.
     
    karyll likes this.