因HMS SDK不合规遭Google Play拒审,需如何修改配置?
解决Google Play审核因HMS SDK违规被拒的Gradle修改方案
问题背景
您的应用包含不符合《设备与网络滥用政策》的内容。我们发现您的应用使用了不合规版本的Huawei Mobile Services (HMS) SDK,该SDK包含从Google Play以外的未知来源下载或安装应用的代码。鉴于该SDK的特性,请将其从提交至Google Play商店的应用版本中移除。
具体修改步骤
1. 清理模块级build.gradle的依赖
移除dependencies块中所有HMS/AGConnect相关的依赖项:
implementation "com.huawei.agconnect:agconnect-auth-google:1.6.4.300"implementation 'com.huawei.agconnect:agconnect-core:1.6.1.300'implementation 'com.huawei.agconnect:agconnect-auth:1.6.1.300'implementation 'com.huawei.agconnect:agconnect-crash:1.4.2.301'implementation 'com.huawei.hms:base:6.2.0.300'
修改后的模块级依赖示例:
dependencies { implementation platform('com.google.firebase:firebase-bom:28.4.2') implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'com.flaviofaria:kenburnsview:1.0.7' implementation 'com.github.bumptech.glide:glide:4.11.0' implementation 'androidx.appcompat:appcompat:1.4.2' implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.navigation:navigation-ui-ktx:2.5.0' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' implementation 'com.google.android.gms:play-services-maps:18.0.2' implementation 'com.google.firebase:firebase-messaging:23.0.6' implementation 'androidx.preference:preference-ktx:1.2.0' implementation 'com.google.firebase:firebase-common-ktx:20.1.1' implementation 'com.google.firebase:firebase-config-ktx:21.1.1' implementation 'com.google.firebase:firebase-inappmessaging-display-ktx:20.1.2' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.navigation:navigation-fragment-ktx:2.5.0' ktlint "com.pinterest:ktlint:0.39.0" implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.okhttp3:okhttp:4.9.0' implementation 'com.google.code.gson:gson:2.8.9' implementation 'com.squareup.retrofit2:converter-gson:2.6.4' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0' implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0' implementation 'com.google.android.material:material:1.6.1' implementation 'com.squareup.moshi:moshi-kotlin:1.12.0' implementation 'com.squareup.retrofit2:converter-moshi:2.9.0' implementation "androidx.cardview:cardview:1.0.0" implementation 'com.instabug.library:instabug:10.12.3' implementation 'me.aflak.libraries:fingerprint:2.5.3' implementation 'com.android.billingclient:billing:5.0.0' implementation 'com.google.android.play:core-ktx:1.8.1' implementation 'com.google.firebase:firebase-config' implementation 'com.google.firebase:firebase-analytics' implementation 'com.google.firebase:firebase-analytics-ktx' implementation 'com.google.android.gms:play-services-auth:20.2.0' implementation 'com.google.android.play:core:1.10.3' implementation 'com.shobhitpuri.custombuttons:google-signin:1.1.0' implementation 'com.facebook.android:facebook-login:6.5.1' implementation 'androidx.work:work-runtime:2.8.0-alpha02' }
2. 清理项目级build.gradle的依赖
移除dependencies块中所有HMS/AGConnect相关的classpath依赖项:
classpath 'com.huawei.agconnect:agcp:1.4.1.300'classpath 'com.huawei.agconnect:agconnect-apms-plugin:1.4.1.306'
修改后的项目级依赖示例:
dependencies { classpath 'com.android.tools.build:gradle:7.0.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.3.13' classpath 'com.google.firebase:firebase-appdistribution-gradle:3.0.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }
额外检查项
- 检查代码中是否有调用HMS SDK的逻辑,确保全部删除,避免编译报错。
- 执行
./gradlew clean清理项目缓存后重新构建,确保无残留的HMS相关资源。 - 若需同时支持华为应用市场和Google Play,建议通过**产品风味(productFlavors)**拆分版本,分别集成对应平台的SDK,避免合规冲突。
内容的提问来源于stack exchange,提问作者Dominik
相关产品推荐
相关产品推荐

