2

trying to implement Account Kit into our app and it is not working.

Using com.huawei.hms:hwid:5.0.3.301 and on signin, blank activity is shown. Hitting back button from this blank activity, log would show onActivityResult 1002 0.

Tried building the demo project from https://github.com/HMS-Core/huawei-account-demo. It is the same thing, clicking on login nothing shows, clicking back button would show signin failed.

What could be the issue?

#UPDATE: ags file was missing from demo, hence the blank activity. Adding the AGS file fixed it.

After verifying that the native android SDK build does work on my device, continued trying to implement on Unity.

Downloaded 4.0.4.300 AccountSDK with 4.0.4.301 Core. Ran the APK and the following error occured:

     Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.test.test.huawei/com.huawei.hms.activity.BridgeActivity}; have you declared this activity in your AndroidManifest.xml?
        at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1950)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1622)
        at android.app.Activity.startActivityForResult(Activity.java:4564)
        at android.app.Activity.startActivityForResult(Activity.java:4522)
        at android.app.Activity.startActivity(Activity.java:4883)
        at android.app.Activity.startActivity(Activity.java:4851)
        at com.huawei.hms.adapter.AvailableAdapter.startResolution(AvailableAdapter.java:155)
        at com.huawei.hms.hwid.a.a.a(HmsAPKVersionCheckUtil.java:46)
        at com.huawei.hms.hwid.internal.ui.activity.HwIdSignInHubActivity.a(HwIdSignInHubActivity.java:212)
        at com.huawei.hms.hwid.internal.ui.activity.HwIdSignInHubActivity.onCreate(HwIdSignInHubActivity.java:106)
        at android.app.Activity.performCreate(Activity.java:7174)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030) 
        at android.app.ActivityThread.-wrap11(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) 
        at android.os.Handler.dispatchMessage(Handler.java:105) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.app.ActivityThread.main(ActivityThread.java:6938) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) 

So then I copied the bridge activity from the HMSSdkUI's manifest into my manifest and the the app built:

        <activity
            android:name="com.huawei.hms.activity.BridgeActivity"
            android:configChanges="orientation|locale|layoutDirection|fontScale|screenSize|smallestScreenSize|screenLayout"
            android:excludeFromRecents="true"
            android:exported="false"
            android:hardwareAccelerated="true"
            android:screenOrientation="behind"
            android:theme="@android:style/Theme.Translucent" >
            <meta-data
                android:name="hwc-theme"
                android:value="androidhwext:style/Theme.Emui.Translucent" />
        </activity>

However, requesting sign in still results in blank activity. Here is the log: I am suspecting it has to do with the BridgeActivity??

2020-10-09 16:02:17.063 20598-20598/? I/HMSSDK_HMSBIInitializer: Builder->biInitFlag :false
2020-10-09 16:02:17.064 20598-20598/? I/HMSSDK_HMSBIInitializer: Builder->biSetting :false
2020-10-09 16:02:17.065 20598-20598/? I/HMSSDK_CountryCodeBean: getCountryCode get country code from SIM_COUNTRY
2020-10-09 16:02:17.068 20598-20598/? I/HMSSDK_CountryCodeBean: getCountryCode get country code from SIM_COUNTRY
2020-10-09 16:02:17.070 20598-20598/? W/NetworkKit_AbstractLocalManager: 20598-20598|null|com.huawei.hms.framework.network.grs.local.a|a|16|addresses not found by routeby in local config{com.huawei.cloud.opensdkhianalytics}
2020-10-09 16:02:17.072 20598-23397/? E/HMSSDK_HMSBIInitializer: get grs failed, the errorcode is -3
2020-10-09 16:02:17.075 1565-3643/? I/ActivityManager: START u0 {act=com.huawei.hms.jos.signIn typ=null flg=0x0 cmp=ComponentInfo{com.test.test.huawei/com.huawei.hms.hwid.internal.ui.activity.HwIdSignInHubActivity}} from uid 10935
2020-10-09 16:02:17.100 1565-2477/? D/GameManagerService: handleForegroundChange(). pkgName: com.test.test.huawei, clsName: com.huawei.hms.hwid.internal.ui.activity.HwIdSignInHubActivity,FgActivityName:com.test.test.huawei/com.huawei.hms.hwid.internal.ui.activity.HwIdSignInHubActivity
2020-10-09 16:02:17.140 20598-20598/? I/HMSSDK_[HUAWEIIDSDK]HwIdSignInClientHub: onCreate
2020-10-09 16:02:17.143 20598-20598/? I/HMSSDK_HiAnalyticsUtil: not ChinaROM
2020-10-09 16:02:17.144 20598-20598/? I/HMSSDK_HiAnalyticsUtil: Get OOBE failed
2020-10-09 16:02:17.144 20598-20598/? I/HMSSDK_HmsAPKVersionCheckUtil: ====== HMSSDK version: 40004300 ======
2020-10-09 16:02:17.144 20598-20598/? I/HMSSDK_HmsAPKVersionCheckUtil: check minVersion:30000000
2020-10-09 16:02:17.148 20598-20598/? E/HMSSDK_X509CertUtil: exception:updatesdkcas.bks
2020-10-09 16:02:17.148 20598-20598/? E/HMSSDK_X509CertUtil: rootCert is null,verify failed 
2020-10-09 16:02:17.149 20598-20598/? E/HMSSDK_HMSPackageManager: failed to verify cert chain
2020-10-09 16:02:17.149 20598-20598/? E/HMSSDK_HMSPackageManager: checkSinger failed
2020-10-09 16:02:17.149 20598-20598/? E/HMSSDK_HMSPackageManager: Failed to find HMS apk
2020-10-09 16:02:17.150 20598-20598/? I/HMSSDK_AvailableAdapter: HMS is not installed
2020-10-09 16:02:17.151 20598-20598/? I/HMSSDK_AvailableAdapter: enter 4.0 HmsCore upgrade process
2020-10-09 16:02:17.151 20598-20598/? I/HMSSDK_AvailableAdapter: Start to resolution for the 1st time.
2020-10-09 16:02:17.151 20598-20598/? I/HMSSDK_AvailableAdapter: startResolution
2020-10-09 16:02:17.156 1565-4083/? I/ActivityManager: START u0 {act=null typ=null flg=0x0 cmp=ComponentInfo{com.test.test.huawei/com.huawei.hms.activity.BridgeActivity}} from uid 10935
2020-10-09 16:02:17.184 1565-4083/? V/WindowManager: Relayout Window{fd32694 u0 com.test.test.huawei/com.huawei.hms.hwid.internal.ui.activity.HwIdSignInHubActivity}: viewVisibility=0 req=720x1336 WM.LayoutParams{(0,0)(fillxfill) sim=#120 ty=1 fl=#1810100 pfl=0x1020000 fmt=-2 wanim=0x1030000 vsysui=0x410 needsMenuKey=2 colorMode=0 naviIconColor=0}
2020-10-09 16:02:17.185 655-655/? I/SurfaceFlinger: id=14264 createSurf (720x1480),1 flag=4, com.test.test.huawei/com.huawei.hms.hwid.internal.ui.activity.HwIdSignInHubActivity#0
2020-10-09 16:02:17.231 1565-2477/? D/GameManagerService: handleForegroundChange(). pkgName: com.test.test.huawei, clsName: com.huawei.hms.activity.BridgeActivity,FgActivityName:com.test.test.huawei/com.huawei.hms.activity.BridgeActivity
2020-10-09 16:02:17.239 1565-3643/? V/WindowManager: finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING Window{fd32694 u0 com.test.test.huawei/com.huawei.hms.hwid.internal.ui.activity.HwIdSignInHubActivity} in Surface(name=com.test.test.huawei/com.huawei.hms.hwid.internal.ui.activity.HwIdSignInHubActivity)
2020-10-09 16:02:17.279 20598-20598/? E/HMSSDK_BridgeActivity: Run time Exception.String resource ID #0x0
2020-10-09 16:02:17.279 20598-20598/? I/HMSSDK_BridgeActivity: Enter finish.
2020-10-09 16:02:17.301 1565-2477/? D/GameManagerService: handleForegroundChange(). pkgName: com.test.test.huawei, clsName: com.huawei.hms.hwid.internal.ui.activity.HwIdSignInHubActivity,FgActivityName:com.test.test.huawei/com.huawei.hms.hwid.internal.ui.activity.HwIdSignInHubActivity
2020-10-09 16:02:17.316 1565-8502/? V/WindowManager: Relayout Window{fd32694 u0 com.test.test.huawei/com.huawei.hms.hwid.internal.ui.activity.HwIdSignInHubActivity}: viewVisibility=0 req=720x1384 WM.LayoutParams{(0,0)(fillxfill) sim=#120 ty=1 fl=#1810100 pfl=0x1020000 fmt=-2 wanim=0x1030000 vsysui=0x410 needsMenuKey=2 colorMode=0 naviIconColor=0}
2020-10-09 16:02:17.334 20598-20598/? I/HMSSDK_UpdateAdapter: onBridgeActivityDestroy
zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
Joe
  • 25
  • 1
  • 6
  • 1
    Have you also set up the AGC, signed the app, set up a fingerprint? – devEnju Oct 01 '20 at 14:40
  • Everything is configured. IAP has been implemented on the side and it works flawlessly. We are currently using 2.6.1 but because it will be removed next year, we are upgrading to 5.x. – Joe Oct 01 '20 at 18:52

4 Answers4

0

Error code 10020 means invalid parameters. Can you check if you are adding correct parameter. Refer Huawei official document on how to sign in using huawei id.

  • You commented error code 10020. the 2 digits are just request code and result code per protected void onActivityResult(int requestCode, int resultCode, Intent data). – Joe Oct 05 '20 at 12:52
0

Are you using HMS Analytics kit because 10020 code is the error code of analytics kit. Check out error codes of analytics kit: https://developer.huawei.com/consumer/en/doc/development/HMSCore-References-V5/android-api-error-code-0000001050987233-V5

If you want to implement Account kit, below are the links which can help you out and may be you will be able to figure it out your problem:

  1. https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201272938220820099&fid=0101187876626530001

  2. https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201206040914750083&fid=0101187876626530001

SanghatiM
  • 173
  • 5
  • You commented error code 10020. the 2 digits are just request code and result code per protected void onActivityResult(int requestCode, int resultCode, Intent data). You can review the sample project @ https://github.com/HMS-Core/huawei-account-demo/blob/master/Account-Client-Java-Demo/Account_Demo_AndroidStudio/app/src/main/java/com/huawei/hmssample/HuaweiIdActivity.java – Joe Oct 05 '20 at 12:54
  • Also, this post is for ACCOUNTS Kit. NOT ANALYTICS KIT. – Joe Oct 05 '20 at 12:59
0

in your sample you are implementing combination of account kit and analytics kit ,analytics kit will return this 10020 Code ,check below URl for you're Implementation purpose Account kit reference

https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201231030637780065&fid=0101187876626530001

sujith E
  • 214
  • 1
  • 7
  • You commented error code 10020. the 2 digits are just request code and result code per protected void onActivityResult(int requestCode, int resultCode, Intent data). You can review the sample project @ https://github.com/HMS-Core/huawei-account-demo/blob/master/Account-Client-Java-Demo/Account_Demo_AndroidStudio/app/src/main/java/com/huawei/hmssample/HuaweiIdActivity.java – Joe Oct 05 '20 at 12:54
  • Also, this post is for ACCOUNTS Kit. NOT ANALYTICS KIT. – Joe Oct 05 '20 at 12:59
0

In the demo, if you click signin, app will try to get authorization to your Huawei Account. Please check whether you are running on the HMS phone and Huawei account is log in.

The demo in the github is a little old, you can download the code from the official page directly. The github demo will be updated ASAP.

sample code

Update:

  1. Please modify the xxx.jks info in the build.gradle file in the app directory.
  2. Please create a project on the AGC platform and set the SHA256 information in the xxx.jks file on the AGC platform.
  3. Please download the agconnect-services.json file from the AGC platform and place the file in the app directory of the project.
zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
  • Running on Samsung phone with HMS 4.0+. HMS 2.6x account sign in works with the same phone, but with HMS 5.x it doesn't. The demo was downloaded from official page, I was just referring to the github link. Clicking on "signin" button from the demo project, I would see a new activity showing, but it is blank. Hitting back button would result in sign in fail error message. So the api is clearly working, but the "screen" is missing. – Joe Oct 08 '20 at 16:21
  • @Joe 1. Please modify the **xxx.jks** info in the **build.gradle** file in the app directory. 2. Please [create a project](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-get-started#createproject) on the AGC platform and set the SHA256 information in the **xxx.jks** file on the AGC platform. 3. Please download the **agconnect-services.json** file from the AGC platform and place the file in the app directory of the project. After these steps completed, try to log in again. If the login still fails, please provide logs for error analysis and locating. – zhangxaochen Oct 09 '20 at 03:49
  • agconnect-services.json was missing from the demo project. added it and the correct activity is shown. – Joe Oct 09 '20 at 19:36
  • The demo project works, but Unity implementation is still showing blank activity. I have updated the post with the log from account signin from Unity (which is still showing blank activity) – Joe Oct 09 '20 at 20:07
  • @Joe OK I updated my answer for the Account Kit issue. For this Unity issue, Unity provides the HMS Plugin here: Unity Asset Store > Huawei HMS Core App Services, and the **README** file contains information about development guides. For more technical questions, please submit a ticket with [Unity Customer Service](https://unity.com/support-services). – zhangxaochen Oct 10 '20 at 07:04
  • Ok, the blank activity has been solved! The problem was with the SDK as I have suspected! With Unity, we can't use SDKs downloaded from official site, have to use maven. I added the maven repo to the unity gradle files just like the asset and everything works. – Joe Oct 10 '20 at 12:18
  • Great. If you have more questions about HMS Core, feel free to contact me. :) – zhangxaochen Oct 12 '20 at 07:46