Search code examples
androidhuawei-mobile-serviceshuawei-developersappgallery-connecthuawei-account

Huawei AGConnectAuth Phone number authentication error: ONLY ONE String Field can be annotated as Url


i want to use phone authentication in my app. When i run the app in android studio, the feature is working fine.

But when i install the released app from app gallery, i' ve got this error : "ONLY ONE String Field can be annotated as Url"

This is build.gradle file:

...
signingConfigs {
   config {
      storeFile file('/Users/username/AndroidStudioProjects/somepath/example.jks')
      storePassword 'password'
      keyAlias 'foldername'
      keyPassword 'password'
   }
}

...
buildTypes {
  debug {
    minifyEnabled false
    debuggable true
    signingConfig signingConfigs.config
  }

  release {
    signingConfig signingConfigs.config
    minifyEnabled true
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  }
}

This is phone authentication request code:

private void startPhoneNumberVerification() {
        // [START start_phone_auth]
        VerifyCodeSettings settings = new VerifyCodeSettings.Builder()
                .action(VerifyCodeSettings.ACTION_REGISTER_LOGIN)
                .locale(Locale.getDefault())
                .sendInterval(30)
                .build();
        Task<VerifyCodeResult> task = AGConnectAuth.getInstance().requestVerifyCode(countryCode, phoneNumberWithoutCountryCode, settings);
        task.addOnSuccessListener(TaskExecutors.uiThread(), new OnSuccessListener<VerifyCodeResult>() {
            @Override
            public void onSuccess(VerifyCodeResult verifyCodeResult) {
                phoneNumberContainer.setVisibility(View.GONE);
                verifyCodeContainer.setVisibility(View.VISIBLE);
            }
        }).addOnFailureListener(TaskExecutors.uiThread(), new OnFailureListener() {
            @Override
            public void onFailure(Exception e) {
                Log.e(TAG, "CODE SEND ERROR : " + e.getMessage());
                // Error : code: 2 message: ONLY ONE String Field can be annotated as Url
                
                }
            }
        });
        // [END start_phone_auth]
    }

App signing settings

enter image description here

Project settings

enter image description here

Thanks for all advice.


Solution

  • Try to add the following obfuscation scripts may solve your issue.

    -keep class com.huawei.agconnect.** {*;}
    -keepresourcexmlelements **
    -keepresources */*