processReleaseMainManifest FAILED when build in cordova 12.0.0

56 Views Asked by At

please help i run in cordova 12.0.0 cordova build android --release -- --packageType=bundle and BUILD FAILED here

Checking Java JDK and Android SDK versions
ANDROID_HOME=C:\Users\xxx\AppData\Local\Android\Sdk (recommended setting)
ANDROID_SDK_ROOT=undefined (DEPRECATED)
Using Android SDK: C:\Users\xxx\AppData\Local\Android\Sdk
Subproject Path: CordovaLib
Subproject Path: app

> Task :app:processReleaseMainManifest FAILED
E:\xxx\platforms\android\app\src\main\AndroidManifest.xml:12:9-16:20 Error:
        android:exported needs to be explicitly specified for element <receiver#com.tonikorin.cordova.plugin.autostart.BootCompletedReceiver>. 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.
E:\xxx\platforms\android\app\src\main\AndroidManifest.xml:17:9-21:20 Error:
        android:exported needs to be explicitly specified for element <receiver#com.tonikorin.cordova.plugin.autostart.UserPresentReceiver>. 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.
E:\xxx\platforms\android\app\src\main\AndroidManifest.xml:22:9-26:20 Error:
        android:exported needs to be explicitly specified for element <receiver#com.tonikorin.cordova.plugin.autostart.PackageReplacedReceiver>. 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.

See https://developer.android.com/r/studio-ui/build/manifest-merger for more information about the manifest merger.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseMainManifest'.
> Manifest merger failed with multiple errors, see logs

* 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.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1s
12 actionable tasks: 1 executed, 11 up-to-date
Command failed with exit code 1: E:\xxx\platforms\android\gradlew -b E:\xxx\platforms\android\build.gradle :app:bundleRelease

is there some other helper? yo?

i use gradle 7.6 and then update to 8.0 and i see The following project in cordova 12.0.0 dependencies were bumpped:

Kotlin: 1.7.21 Gradle: 7.6 Android Gradle Plugin (AGP): 7.4.2 Google Services Gradle Plugin: 4.3.15 AndroidX App Compat Library: 1.6.1 AndroidX WebKit Library: 1.6.0 AndroidX SplashScreen Core Library: 1.0.0

this is my AndroidManifest

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10003" android:versionName="1.0.3" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:exported="true" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@style/Theme.App.SplashScreen" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <receiver android:enabled="false" android:name="com.tonikorin.cordova.plugin.autostart.BootCompletedReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <receiver android:enabled="false" android:name="com.tonikorin.cordova.plugin.autostart.UserPresentReceiver">
            <intent-filter>
                <action android:name="android.intent.action.USER_PRESENT" />
            </intent-filter>
        </receiver>
        <receiver android:enabled="true" android:name="com.tonikorin.cordova.plugin.autostart.PackageReplacedReceiver">
            <intent-filter>
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            </intent-filter>
        </receiver>
    </application>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</manifest>

what's wrong with this?

1

There are 1 best solutions below

1
Eric On

It's in the error you pasted. The plugin com.tonikorin.cordova.plugin.autostart needs to be updated to set android:exported when merging the Manifest because it uses intent-filter

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.