Build Ionic app with Capacitor 4 for Huawei AppGallery failed

427 Views Asked by At

We had to increase targetSdkVersion to 32, because, according to Google Play rules, it's not possible to publish apps with sdk version <31, and had to migrate to Capacitor 4. It's ok whe deploy to Google Play (with slightly different build.gradle file appropriate for it). Any suggestion to solve problem with Huawei AppGallery?

We build Ionic app with Capacitor 4 for Huawei AppGallery by gradlew with following build.gradle file

buildscript {

repositories {
    google()
    jcenter()
    maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
    classpath 'com.android.tools.build:gradle:7.2.1'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.huawei.agconnect:agcp:1.6.5.300'
}
}

apply from: "variables.gradle"

allprojects {
    repositories {
        google()
        maven { url 'https://developer.huawei.com/repo/' }
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

and following variables.gradle file

ext {
    minSdkVersion = 26
    compileSdkVersion = 32
    targetSdkVersion = 32
    androidxActivityVersion = '1.4.0'
    androidxAppCompatVersion = '1.4.2'
    androidxCoordinatorLayoutVersion = '1.2.0'
    androidxCoreVersion = '1.8.0'
    androidxFragmentVersion = '1.4.1'
    coreSplashScreenVersion = '1.0.0-rc01'
    androidxWebkitVersion = '1.4.0'
    junitVersion = '4.13.2'
    androidxJunitVersion = '1.1.3'
    androidxEspressoCoreVersion = '3.4.0'
    cordovaAndroidVersion = '10.1.1'
}

and got an error

    > Task :capacitor-cordova-android-plugins:processReleaseManifest FAILED
    /Users/scdbo/.jenkins/workspace/IBR_GENERAL/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml:7:1-11:12 Error:
  android:exported needs to be explicitly specified for element <receiver#com.huawei.hms.cordova.push.receiver.HmsLocalNotificationBootEventReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
0

There are 0 best solutions below