HMS:在Unity Project中集成IAP后,IAP没有在Repack APK中初始化

HMS: After integrating the IAP in Unity Project, IAP is not initializing in the Repack APK

在Unity Project中集成IAP后,IAP不会在Repack APK中初始化,而是在UDP APK中工作。

我使用 2.2.2 版本的 Unity Distribution Portal 包进行应用内购买。在 UDP apk 中测试应用程序时,它似乎运行良好。之后,当我们将该 apk 上传到 Unity dashboard 进行 Repack 时,IAP 没有初始化(意味着可以看到欢迎 xxxx,之后什么都没有。)

https://assetstore.unity.com/packages/add-ons/services/billing/unity-distribution-portal-138507

下面的代码显示了清晰的图片。

private class InitListener : IInitListener

    {

        public void OnInitialized(UserInfo userInfo)

        {

            Debug.Log("[Game]On Initialized succeeded");

            Show("Initialize succeeded. Start query inventory.");    - It's calling till here.

            StoreService.QueryInventory(MPurchaseListener);

            _mInitialized = true;

        }
 

        public void OnInitializeFailed(string message)

        {

            Debug.Log("[Game]OnInitializeFailed: " + message);

            Show("Initialize Failed: " + message);

        }

    }

依赖列表:

implementation 'com.huawei.hms:base:5.0.3.300'

implementation 'com.huawei.hms:hwid:5.2.0.300'      

implementation 'com.huawei.hms:iap:5.0.4.301'

谁能建议我解决这个问题。提前致谢!

在Unity应用中使用Unity UDP包集成IAP可以参考this guide

建议您re-integrate参考上述link中的每个步骤。如果re-integration仍然失败并出现同样的问题,请提供一些详细的日志以供分析和排查其根本原因。

使用下面的依赖:

implementation 'com.huawei.hms:ads-lite:13.4.29.303'
implementation 'com.huawei.hms:ads-consent:3.4.30.301'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.huawei.hms:hianalytics:5.1.0.300'
implementation 'com.huawei.agconnect:agconnect-core:1.2.0.300'
implementation 'com.huawei.agconnect:agconnect-crash:1.4.1.300'

请按照统一document参考。