Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter Build Fails with HMS Integration: com.huawei.agconnectclouddb.objecttypes Package Not Found #14

Open
dev-munashe opened this issue Feb 28, 2024 · 2 comments

Comments

@dev-munashe
Copy link

I am working on integrating Huawei Mobile Services (HMS) into my existing Flutter application by following the official documentation.

Here is what I have done so far:

  1. I have created a project in AppGallery Connect and set up an Android app.

  2. Downloaded the agconnect-services.json configuration file and placed it in the android/app directory.
    image

3.Added the necessary Gradle configurations to the project-level build.gradle and the app-level build.gradle.

android level build.gradle:
`allprojects {
repositories {
google()
jcenter()
// Add the following line:
maven {url 'https://developer.huawei.com/repo/'}
}
}

buildscript {
repositories {
google()
jcenter()
// Add the following line:
maven {url 'https://developer.huawei.com/repo/'}
}
}
//buildscript > dependencies
buildscript {
dependencies {
// Add the following line:
classpath 'com.huawei.agconnect:agcp:1.9.0.300'
}
}`

app-level build.gradle:
apply plugin: 'com.huawei.agconnect'

  1. Included the HMS dependencies agconnect_crash and agconnect_clouddb in my pubspec.yaml:

image

  1. Ran 'flutter pub get' to fetch packages.

But when I try to run the application, the build fails with the following errors:
`PS C:\Users\User\hulatech_teacher_app> flutter run
Launching lib\main.dart on JNY LX1 in debug mode...
C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dev\agconnect_clouddb-1.9.0+300\android\src\main\java\com\huawei\agconnectclouddb\modules\AGCCloudDBModule.java:29: error: package com.huawei.agconnectclouddb.objecttypes does not exist
import com.huawei.agconnectclouddb.objecttypes.ObjectTypeInfoHelper;
^
C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dev\agconnect_clouddb-1.9.0+300\android\src\main\java\com\huawei\agconnectclouddb\utils\AGCCloudDBUtil.java:8: error: package com.huawei.agconnectclouddb.objecttypes does not exist
import com.huawei.agconnectclouddb.objecttypes.ObjectTypeInfoHelper;
^
C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dev\agconnect_clouddb-1.9.0+300\android\src\main\java\com\huawei\agconnectclouddb\modules\AGCCloudDBModule.java:77: error: cannot find symbol
AGConnectCloudDB.getInstance().createObjectType(ObjectTypeInfoHelper.getObjectTypeInfo());
^
symbol: variable ObjectTypeInfoHelper
location: class AGCCloudDBModule
C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dev\agconnect_clouddb-1.9.0+300\android\src\main\java\com\huawei\agconnectclouddb\utils\AGCCloudDBUtil.java:14: error: cannot find symbol
for (Class<? extends CloudDBZoneObject> clazz : ObjectTypeInfoHelper.getObjectTypeInfo().getObjectTypes()) {
^
symbol: variable ObjectTypeInfoHelper
location: class AGCCloudDBUtil
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':agconnect_clouddb:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 49s
Running Gradle task 'assembleDebug'... 50,8s
Exception: Gradle task assembleDebug failed with exit code 1`

HMS dependencies versions provided by the official documentation were out of date, so I checked the pub.dev and updated the versions. I was expecting the app to build successfully and run in debug mode on my emulator/device.

What could be causing these errors, and how can I resolve them?

@UsamaHameed1
Copy link

Hi,
I am also facing the same issue can you guide me how you fixed this issue?

@hamflx
Copy link

hamflx commented Jun 9, 2024

Is there anyone who could offer a solution to this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants