目录

Do not obfuscate HMS Core SDK before compiling the APK. Otherwise, function errors may occur.

The configuration file in Android Studio is proguard-rules.pro, and that in Eclipse is proguard-project.txt.

1.  Open the obfuscation configuration file of your project.

2. Add configuration to ensure that HMS Core SDK is not obfuscated.

  1. -ignorewarnings
  2. -keepattributes *Annotation*
  3. -keepattributes Exceptions
  4. -keepattributes InnerClasses
  5. -keepattributes Signature
  6. -keepattributes SourceFile,LineNumberTable
  7. -keep class com.hianalytics.android.**{*;}
  8. -keep class com.huawei.updatesdk.**{*;}
  9. -keep class com.huawei.hms.**{*;}

3.  If you have used AndResGuard, add the AndResGuard allowlist to the obfuscation configuration file.

  1. "R.string.hms*",
  2. "R.string.connect_server_fail_prompt_toast",
  3. "R.string.getting_message_fail_prompt_toast",
  4. "R.string.no_available_network_prompt_toast",
  5. "R.string.third_app_*",
  6. "R.string.upsdk_*",
  7. "R.string.agc*",
  8. "R.layout.hms*",
  9. "R.layout.upsdk_*",
  10. "R.drawable.upsdk*",
  11. "R.color.upsdk*",
  12. "R.dimen.upsdk*",
  13. "R.style.upsdk*"