Need more help? Go to Stack Overflow.
What should I do if the text in the IDE is too small to be clearly viewed when I use HMS Toolkit on a MateBook?
This is caused by the compatibility issue of Android Studio. To use HMS Toolkit on the MateBook, use Android Studio 3.3 or later.
What should I do if I cannot find the HMS sub-menu on the Android Studio menu bar after installing the HMS Toolkit plug-in?
This is caused by a bug of Android Studio. Ensure that the idea.config.path and idea.system.path parameters in the idea.properties file in the bin folder of Android Studio are commented out or set to default values.
What should I do if the SHA-256 certificate fingerprint cannot be generated in Configuration Wizard?
Description
The SHA-256 certificate fingerprint cannot be generated in Configuration Wizard.

Cause analysis:
In HMS Toolkit, the following gradlew command is used to generate a certificate fingerprint. Then, you can enter the certificate fingerprint in AppGallery Connect.
- Windows: gradlew Task :Module name:signingReport
- macOS: ./gradlew Task :Module name:signingReport
The possible causes are as follows:
- The network is disconnected.
- Failed to build the project.
- The Gradle plugin does not match Android Studio. For details, please refer to Android Gradle plugin release notes.
- The Gradle plugin version is too early. Ensure that the version is later than that specified by classpath 'com.android.tools.build:gradle:3.3.0'.
Solution
- Enter gradle Task :app:signingReport in Terminal. After the command is executed, the results in the following figure are obtained (message "BUILD SUCCESSFUL" is displayed and the SHA-256 certificate fingerprint is generated). If the results cannot be obtained, refer to the related documents of the gradle command to rectify the fault, and use Configuration Wizard again.

- If the network is abnormal, check the network connection or HTTP proxy.
- If the fault persists, perform operations based on Generating a Signing Certificate Fingerprint. Enter the fingerprint in the text box under Generate a certificate fingerprint. After the fault is rectified, process other configuration items. When all the configuration items pass the check, use Coding Assistant or Convertor.
How do I enable automatic replacement of constants in a switch case statement?
According to the Java syntax rules, the constants in a switch case statement cannot be replaced using the getXXX() method. Therefore, to improve user experience, the tool dynamically generates an enum by analyzing the GMS class in the switch case statement of the project, and then replaces the GMS constants in the original case statement with the enumerated constants.
Example:
GMS class:
public class G {
public static final int FAILED = 0;
public static final int SUCCESS = 1;
public static final int NONE = 2;
}
HMS class:
public class H {
public static final int FAILED = 1;
public static final int SUCCESS = 2;
public static final int NONE = 0;
}
Service code:
int result = 1;
switch (result) {
case G.SUCCESS:
System.out.println("success");
break;
case G.FAILED:
System.out.println("failed");
break;
case G.NONE:
System.out.println("none");
break;
default:
System.out.println("default");
}
The tool automatically generates the following enum after analyzing the code in the preceding switch case statement:
public enum GHEnum {
FAILED(G.FAILED, H.FAILED),
SUCCESS(G.SUCCESS, H.SUCCESS),
NONE(G.NONE, H.NONE);
private int gmsValue;
private int hmsValue;
GHEnum(int gmsValue, int hmsValue) {
this.gmsValue = gmsValue;
this.hmsValue = hmsValue;
}
public int getGmsValue() {
return gmsValue;
}
public int getHmsValue() {
return hmsValue;
}
public static GHEnum translateValue(int value) {
if (org.xms.g.utils.GlobalEnvSetting.isHms()) {
for (GHEnum val : GHEnum.values()) {
if (val.getHmsValue() == value) {
return val;
}
}
} else {
for (GHEnum val : GHEnum.values()) {
if (val.getGmsValue() == value) {
return val;
}
}
}
return null;
}
}
Replace the constants in the case statement in the service code based on the generated enum as follows:
int result = 1;
switch (GHEnum.translateValue(result)) {
case SUCCESS:
System.out.println("success");
break;
case FAILED:
System.out.println("failed");
break;
case NONE:
System.out.println("none");
break;
default:
System.out.println("default");
}
What should I do if the results of the second scanning are abnormal after an automatic conversion using Convertor?
Description
After Convertor completes a scanning and analysis, if one-click conversion is performed for selected items that support automatic conversion, the GMS class will be converted to a corresponding HMS or XMS class. However, if the class contains any item that should be manually converted, but is not yet converted, the item will not be identified in the second scanning, because the class has been converted to an HMS or XMS class and can no longer be identified by the tool.
For example, if the project contains the following code:
import com.gms.ClassA;
new ClassA().methodA();
If ClassA can be automatically converted to com.hms.ClassB, but methodA() needs to be manually modified, then:
For the first time, the tool provides the following results after the scanning and analysis:
- import com.gms.ClassA can be automatically converted to import com.hms.ClassB.
- new ClassA().methodA() can be automatically converted to new ClassB().methodA().
- The call of methodA() requires manual modification.
The first one-click conversion function will change the preceding code to:
import com.hms.ClassB;
new ClassB().methodA();
If a second scanning is performed at this time, the tool cannot detect that methodA() requires manual modification. This is because the code entity is com.hms.ClassB, and com.hms.ClassB does not contain methodA() that requires manual modification.
Solution
Use the backup project generated in the first scanning to restore the project, and perform conversion analysis again.
What should I do if the permission processing logic is faulty after conversion to HMS?
Question: I have verified all permissions listed in the Manifest file, and performed logic processing based on the verification results. After conversion under the To HMS API policy, the processing logic is faulty. What should I do?
Answer: After you integrate HMS capabilities, some extra permissions will be introduced, such as the third-party app installation permission, which is used to update HMS Core (APK). You do not need to apply for such permissions in the code. We will display a dialog box to notify you when necessary, for example, when HMS Core (APK) needs to be updated. When such a problem occurs, change the permission verification logic and verify only the required permissions.
What is the current promotion strategy of HMS Toolkit?
HMS Toolkit supports analysis of manual conversion, aiming to increase the conversion efficiency. It provides two conversion policies: Add HMS API and To HMS API. You can choose one as needed.
If you have any questions or suggestions about the tool, please feel free to contact us. We will respond in a timely manner and help you improve the HMS Core integration efficiency.
Which development languages are supported currently? Is there any plan to support React Native?
Currently, Java is supported. As for Kotlin, we are now developing the function. React Native is under analysis and will be supported in a later version.
Currently, the Add HMS API policy is used in most cases. How do we ensure success of tool-based conversion?
The success rate of the Add HMS API policy is higher because the code of the adaptation layer is added. In addition, the policy supports both GMS and HMS through one set of code. Maintenance of adaptation code will be supported.
Currently, the conversion process is divided into two steps: analysis and conversion. You can also try to perform analysis only (without performing conversion). If you have any questions, submit a ticket online. Huawei will get back to you as soon as possible. For details about the ticket submission procedure, please refer to Submitting a Ticket Online.
Does HMS Toolkit support multiple modules?
Yes. Currently, all modules are encapsulated into a lib. The lib depends on the HMS and GMS SDKs and other modules depend on the lib.
Does HMS Toolkit support automatic download of the AppGallery Connect configuration file from AppGallery Connect to a project directory?
This function is not supported currently and will be planned in later versions.
Currently, some kits do not support tool-based conversion. Do these kits have any plans to support this function? Can the tool identify APIs of these kits?
These kits do not support tool-based conversion due to great differences between APIs. Manual conversion is still recommended.
Does HMS Toolkit support conversion of Firebase services?
Yes.
Are plug-ins similar to Android Studio, such as Flutter and Xamarin, provided to support a cross-platform IDE?
A cross-platform IDE will be planned by the HMS Core project team based on your requirements.
How do I enable the code reduction function of Android Studio?
XMS code generated using the Add HMS API policy will increase the size of your app. You can enable the code reduction function by adding or modifying the following configurations in the
app/build.gradle file:
android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
If an error message such as "Can't find...", "NoClassDefFoundError", "ClassNotFoundException", "NoSuchFieldException", or "NoSuchMethodException" is displayed after minifyEnabled is set to true, configure the following XMS obfuscation rules in app/proguard-rules.pro:
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-keep class com.huawei.agconnect.**{*;}
-keep interface com.huawei.agconnect.**{*;}
-keep class com.huawei.hmf.**{*;}
-keep class com.google.android.gms.**{*;}
-keep interface com.google.android.gms.**{*;}
-keep class com.google.firebase.**{*;}
-keep interface com.google.firebase.**{*;}
-keep class org.xms.**{*;}
-keep interface org.xms.**{*;}
For details about the obfuscation rules, please refer to Configuring Obfuscation Scripts.
What can I do if a compilation error occurs after the dependency version of an HMS Core kit is updated separately?
For example, the dependency in the original code is implementation 'com.huawei.hms:maps:4.0.1.300', which is replaced with implementation 'com.huawei.hms:maps:4.0.2.300' after the update. A compilation error occurs, indicating that some APIs cannot be found.
The possible cause is that the version of the dependency com.huawei.hms:base in the .pom file of a kit is later than that of the dependency implementation 'com.huawei.hms:base:version number' in the project-level gradle file.
To solve this problem, update com.huawei.hms:base in dependencies to the latest version. For related version requirements, please refer to GMS API Version Required for Each Kit.
What should I do if I require dynamic permissions or do not have static permissions when I compile XMS Adapter code separately?
If you do not have static permissions and your app project has been compiled, copy the permissions from the AndroidManifest.xml file in the app's directory to that in the xmsadapter directory.
If dynamic permissions are required, add lintOptions to the build.gradle file in the xmsadapter directory to mask this compilation alarm.
How do I generate a JAR package for the XMS code?
Use HMS Toolkit to scan and analyze the project. After that, the XMS code will be generated. In the Gradle bar on the right of the project, the createFullJarDebug and createFullJarRelease (in the other group) command options are available to generate the JAR packages for the debug version and release version, respectively. The generated result is stored in the xmsadapter subdirectory (xmsadapter\build\intermediates\full_jar\debug\createFullJarDebug\full.jar) by default. The full.jar package can be directly referenced by other app projects.
How do I perform conversion for a new GMS API?
If you need to introduce a new GMS API to develop a new function, and the conversion needs to be performed in the Add HMS API policy, you can add the implementation dependency of the API to the dependencies{} block in the build.gradle file of the corresponding module, and then use the New Conversion function provided by Convertor to perform scanning and analysis again.
For details about the version requirements of GMS APIs and HMS APIs, please refer to GMS API Version Required for Each Kit.
When allprojects is not configured the build.gradle file in the root directory of the project, an error is reported when the XMS Adapter synchronizes the project. What should I do?
Open the build.gradle files of the XMS Adapter and other related modules, and add the following configuration to dependencies:
dependencies {
repositories {
jcenter()
google()
maven {url 'https://developer.huawei.com/repo/'}
}
}
Alternatively, add the following configuration to the build.gradle file in the root directory of the project:
allprojects {
repositories {
jcenter()
google()
maven {url 'https://developer.huawei.com/repo/'}
}
}
What should I do if the HMS versions are inconsistent after the conversion?
As shown in the following figure, two different HMS version numbers are displayed after conversion by Convertor. By default, the later version is selected during compilation and packaging. You can delete the earlier version based on the site requirements.

When Convertor is used to trigger the automatic synchronization function, if the synchronization task is always in Syncing state, what should I do?
Update Android Studio to 4.1 or later.
What should I do if the GRS fails to be accessed and related functions cannot be used?
Description
When Toolkit is used to access the external network, an event log is reported, indicating that the GRS connection fails and the function cannot be used, as shown in the following figure.

Solution
- Check the network connection and proxy configuration. Visit https://grs.dbankcloud.com/grs/1.0/devecostudio/router using a browser, and check whether the GRS address can be accessed in the network.

- If the access is normal, check the Android Studio IDE proxy configuration. Ensure that the user name and password are correct. If the user name or password is incorrect, the connection still fails. In addition, use the Check connection function to check whether https://grs.dbankcloud.com/grs/1.0/devecostudio/router can be accessed.

When I start HMS Toolkit for the first time or click Cloud Debugging, the Download Resource progress bar is displayed, but the download fails. What should I do?
Description
When HMS Toolkit is started, some resources, such as basic configurations or dependency libraries, need to be dynamically downloaded. If the download fails, some functions (for example, Cloud Debugging) cannot be used. The figure below shows the error information.

Solution 1:
To download the resources, ensure that the IDE can properly access the Internet. First, check the Internet connection of your PC. If the Internet connection is normal, check the proxy settings for the IDE. (If your PC can directly access the Internet, the proxy settings can be No proxy for the IDE. Otherwise, ensure that the proxy is correctly set for the IDE. For example, the proxy server domain name, user name, and password are correctly set.) After correctly setting the proxy for the IDE, use the Check connection function to check whether the IDE can properly access https://grs.dbankcloud.com/grs/1.0/devecostudio/router. If "Connect successful" is displayed, the IDE can properly access the Internet. You can restart Android Studio or click Cloud Debugging to trigger resource download. If the download still fails, try solution 2.

Solution 2:
If your PC can properly access the Internet but the download still fails, the possible cause is that cached resources of HMS Toolkit fail to be loaded. In this case, close Android Studio, delete the cache directory of HMS Toolkit (C:\Users\$user.name\.hmstoolkit in Windows, or /users/$user.name/.hmstoolkit in macOS), and start Android Studio again.
What can I do if the image connection channel is disconnected when Cloud Debugging is used?
Description
When you use Cloud Debugging, if a network exception or other problems occur, the image connection channel is disconnected, as shown in the following figure. As a result, the debugging cannot continue.

The Event Log window displays the message as shown in the following figure.

Solution
After restoring the network, click reconnect in Event Log to rectify the fault. After the fault is rectified, the following figure is displayed.

What can I do if the page is repeatedly displayed or is loading after I sign in to HMS Toolkit?
- If you use Chrome of a later version, cross-domain cookies may be disabled.
Solution: Click
in the address bar of the browser and make sure that op.hicloud.com is in the Allowed list.

- If you use Safari, cross-domain cookies may be disabled.
Solution: Click
on Mac, go to Safari > Preferences, click Privacy, and deselect Block all cookies.

- If you are using Internet Explorer, the current browser version may be incompatible.
Solution: Add the website to the zone.

How do I generate a release.apk file in a project?
- On the menu bar of Android Studio, choose Build > Generate Signed Bundle / APK....

- Select APK and click Next.

- Create a certificate (by clicking Create new...) or select an existing certificate (by clicking Choose existing...), and click Next. To learn more about the certificate, please refer to Sign your app.

- Set Build Variants to release, select V1 (Jar Signature) and V2 (Full APK Signature) in Signature Versions, and click Finish.

The app-release.apk file is generated in the project directory.

HMS Toolkit 6.3.0.300 installed in Android Studio cannot be used. Why?
The possible cause is that the HMS Toolkit version is incompatible with the Android Studio version. Refer to Supported Android Studio Versions to install the mapping version.
What should I do if Cloud Debugging does not respond and message "The device may be in standby or screen-off state, please touch or drag the screen to wake up your device." is displayed?

Solution
This error occurs because cached resources of HMS Toolkit fail to be loaded. In this case, close Android Studio, delete the cache directory of HMS Toolkit (C:\Users\$user.name\.hmstoolkit in Windows, or /users/$user.name/.hmstoolkit in macOS), and start Android Studio again.
What should I do if Cloud Debugging cannot use the debugging mode and message "USB debugging not allowed" is displayed?

Description
Some real devices of Cloud Debugging have the Guest and Owner modes. In Guest mode, some sensitive operations are not allowed, such as debugging the app and modifying the device parameters.
Solution
Switch to the Owner mode for app debugging.

I have created an app in AppGallery Connect, but the message "No product information was detected in AppGallery Connect" is still displayed when I use the Configuration Wizard. Why?

Description
The Configuration Wizard uses the package name to check whether an app corresponding to the local project has been created in AppGallery Connect. This message will be displayed if the Configuration Wizard cannot obtain the local package name or no app corresponding to the package name exists in AppGallery Connect.
Solution
First, check whether the module selected in the Configuration Wizard is correct.
Then, check the build.gradle file of the selected module, and find android > defaultConfig > applicationId. The value of applicationId is the local package name used by the Configuration Wizard for detection.

NOTE
Android Studio allows you to configure the package name flexibly. If you do not use applicationId in the build.gradle file to specify the package name and you want to use the Configuration Wizard to configure the environment for integrating HMS Core, you can temporarily add the applicationId field to the file and delete it after completing the environment configuration. Then, click Link to go to AppGallery Connect and check whether the app package name in AppGallery Connect is the same as the local one.

How do I change the Java runtime?
Android Studio Flamingo/Android Studio Giraffe/Android Studio Hedgehog
- Go to Help > Find Action in Android Studio.

- Search for Choose Boot Java Runtime for the IDE.

- Click Select runtime.

- Select a runtime that includes JCEF and click OK to download the IDE automatically.

- Click Restart now.

Android Studio Bumblebee/Android Studio Chipmunk/Android Studio Dolphin/Android Studio Electric Eel
- Go to Help > Find Action in Android Studio.

- Search for Choose Boot Java Runtime for the IDE.

- Click Select runtime.

- Select a runtime that includes JCEF and click OK to download the IDE automatically.


- Click Restart now.

Android Studio Arctic Fox
Windows
- Solution (with the Choose Runtime Plugin)
- Go to the JetBrains release page and download JBR.

- Go to Help > Find Action in Android Studio Arctic Fox.

- Search for Choose Runtime.

- Click the icon in the red box.

- Select the JBR you have downloaded in the folder of Android Studio Arctic Fox.

- Click Install.

- Wait until Android Studio is restarted automatically.
- Solution (Manual Change)
- Go to the JetBrains release page and download JBR.

- Go to the folder of Android Studio Arctic Fox.

- Move the JBR you have downloaded to the folder of Android Studio Arctic Fox.

- Change the name of the current jre folder to old-jre.

- Right-click the JBR you have downloaded and choose Extract Here.


- Change the name of the jbr folder you have obtained from the extraction to jre.

- Restart Android Studio.
MAC
- Solution (with the Choose Runtime Plugin)
- Go to the JetBrains release page and download JBR.
- Go to Applications and open Android Studio Arctic Fox.

- Go to Help > Find Action in Android Studio.

- Search for Choose Runtime.

- Select a runtime.

- Select the JBR you have downloaded in the folder of Android Studio Arctic Fox.

- Click Install.

- Wait until Android Studio is restarted automatically.
- Solution (Manual Change)
- Go to the JetBrains release page and download JBR.
- Go to Applications.

- Right-click AS-ArcticFox and choose Show Package Contents.

- Double-click Contents.

- View the files included in Contents.

- Change the name of the current jre folder to old-jre.


- Move the JBR you have downloaded to the folder of Android Studio Arctic Fox folder and extract it here.


- Right-click jbr and choose Rename.

- Change the name of the jbr folder you have obtained from the extraction to jre.

- Restart Android Studio.
Ubuntu
- Solution (with the Choose Runtime Plugin)
- Go to the JetBrains release page and download JBR.

- Open Android Studio Arctic Fox.
- Go to Help > Find Action in Android Studio.

- Search for Choose Runtime.

- Select a runtime.

- Select the JBR you have downloaded in the folder of Android Studio Arctic Fox.

- Click Install.

- Wait until Android Studio is restarted automatically.
- Solution (Manual Change)
- Go to the JetBrains release page.

- Go to the folder of Android Studio Arctic Fox.

- Change the name of the current jre folder to oldjre.

- Extract the JBR you have downloaded in the folder of Android Studio Arctic Fox.




- Change the name of the jbr folder you have obtained from the extraction to jre.

- Restart Android Studio.