You can create an app in AppGallery Connect. Then AppGallery Connect will automatically generate basic configuration information for it.

  1. Sign in to AppGallery Connect.
  2. Click My projects.
  3. Click Add project. In the dialog box that is displayed, enter a project name, and click OK.
  4. Go to Project settings > General information. On the page displayed, click Add app.
  5. On the Add app page, set the app name, package name, platform, device, app category (app or game), and language for your app as needed.
  6. Check the app package name and other information in your project under My projects.

Create a Flutter project in Android Studio. The package name of the created app must be the same as that entered in AppGallery Connect.

  1. Open Android Studio, and go to File >New > New Flutter Project to create a Flutter project.

  2. Choose Flutter Application and click Next.
  3. Enter a project name, select the Flutter SDK installation path and project storage location, and click Next.
  4. Enter the app package name in AppGallery Connect and click Finish.
  1. Open the build.gradle file in the android folder of the Flutter project and add the Maven repository and AppGallery Connect plugin.
    buildscript { repositories { google() jcenter() // Check that you have the following line (if not, add it) maven { url 'https://developer.huawei.com/repo/' } // HUAWEI Maven repository } dependencies { classpath 'com.android.tools.build:gradle:3.5.3' // Add the following line classpath 'com.huawei.agconnect:agcp:1.5.0.300' // HUAWEI agcp plugin } } allprojects { repositories { google() jcenter() // Check that you have the following line (if not, add it): maven { url 'https://developer.huawei.com/repo/' } // HUAWEI Maven repository } }
  2. Open the build.gradle file under android/app and add build dependencies.

    Add the following information to the line following apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle":

    apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" // Make sure that the following line is added. apply plugin: 'com.huawei.agconnect'
Code copied