0

Hell, I am building a Flutter app that uses both Firebase and Huawei Mobile Services and updated my flutter to 3.35 and used the community version of huawei_push. However, even though I have placed the agconnect-services.json file in the project, the Gradle build still shows the following message:

! agconnect-services.json not found, compiling without HMS

Current project structure:

android/
app/
build.gradle
google-services.json
agconnect-services.json
src/
main/
AndroidManifest.xml
agconnect-services.json (I also copied it here)
android/app/build.gradle:
plugins {
 id 'com.android.application'
 id 'com.huawei.agconnect'
 id 'com.google.gms.google-services'
}
android {
 compileSdk 36
 defaultConfig {
 applicationId "com.example.myapp"
 minSdk 24
 targetSdk 36
 versionCode 1
 versionName "1.0"
 }
}
dependencies {
 implementation platform('com.google.firebase:firebase-bom:33.5.1')
 implementation 'com.google.firebase:firebase-messaging'
}
android/settings.gradle:
pluginManagement {
 repositories {
 gradlePluginPortal()
 google()
 mavenCentral()
 maven { url 'https://developer.huawei.com/repo/' }
 }
}
dependencyResolutionManagement {
 repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
 repositories {
 google()
 mavenCentral()
 maven { url 'https://developer.huawei.com/repo/
 ' }
 }
}

What I have tried:

  • Copied agconnect-services.json both to app/ and app/src/main/

  • Verified that the JSON content is valid and has the correct package name

  • Added the Huawei Maven repository to both settings.gradle and root build.gradle

  • Cleaned and rebuilt the project using:

 flutter clean
 ./gradlew --stop
 flutter pub get
 flutter build apk
  • Using plugin version: classpath 'com.huawei.agconnect:agcp:1.9.1.301'

  • Diagnostic prints confirm that the file exists:

AGC variant check \[debug\] -\> true @ .../android/app/src/main/agconnect-services.json
AGC variant check \[release\] -\> true @ .../android/app/src/main/agconnect-services.json

Yet Gradle still outputs:

! agconnect-services.json not found, compiling without HMS

Question:

What could still cause this message even though the file exists in both app/ and app/src/main/ and the plugin is applied? Is there a Gradle version or AGConnect plugin mismatch, or a specific directory the plugin now expects? Any working configuration example or explanation would be appreciated.

asked yesterday

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.