I have just recently upgraded my cordova environment and now when I compile my app I am getting the following error:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> Android resource linking failed
ERROR: C:\Users\rolin\dev\myApp\platforms\android\app\src\main\AndroidManifest.xml:34:9-140: AAPT: error: resource drawable/notification_icon (aka com.myApp:drawable/notification_icon) not found.
The error indicates it can't find the resource file but I verified all my resource files exist. I even open them individually and resaved them to ensure they are not corrupted.
In my config.xml:
... ...In my AndroidManifest.xml:
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="5020" android:versionName="0.50.20" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<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="singleTask" android:name="MainActivity" android:theme="@style/Theme.App.SplashScreen" android:windowSoftInputMode="adjustPan">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:authorities="${applicationId}.cdv.core.file.provider" android:exported="false" android:grantUriPermissions="true" android:name="androidx.core.content.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/cdv_core_file_provider_paths" />
</provider>
<service android:enabled="true" android:exported="false" android:name="com.google.android.gms.measurement.AppMeasurementService" />
<service android:exported="false" android:name="org.apache.cordova.firebase.FirebasePluginMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver android:name="org.apache.cordova.firebase.OnNotificationOpenReceiver" />
<activity android:excludeFromRecents="true" android:exported="true" android:name="org.apache.cordova.firebase.OnNotificationReceiverActivity" android:noHistory="true" android:taskAffinity="" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/accent" />
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="@string/default_notification_channel_id" />
<meta-data android:name="firebase_analytics_collection_enabled" android:value="true" />
<meta-data android:name="firebase_performance_collection_enabled" android:value="true" />
<meta-data android:name="firebase_crashlytics_collection_enabled" android:value="true" />
<meta-data android:name="firebase_messaging_auto_init_enabled" android:value="true" />
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="true" />
<meta-data android:name="google_analytics_default_allow_analytics_storage" android:value="true" />
<meta-data android:name="google_analytics_default_allow_ad_storage" android:value="true" />
<meta-data android:name="google_analytics_default_allow_ad_user_data" android:value="true" />
<meta-data android:name="google_analytics_default_allow_ad_personalization_signals" android:value="true" />
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
</application>
<queries>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
</queries>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>
What I have upgraded:
upgrade cordova-cli from 11.1.0 to v12.0
upgrade cordova-android from 11.0 to v13.0
upgrade nodejs v14.22 to v22.16
upgrade java jkd from 11 to v17
local gradle 6.9.1 to 7.6.5 (I have read this isn't needed as cordova-android is using its own gradle version)
I have then removed all my plugins down just a few to start rebuilding but I continuously can't get past this error. I have read a few dozen SOs on related issues and the only thing that I cam across is that this could be a compatibility issue, I am still running Ionic v1 and up to cordov-android v11 everything has run just fine, but after the upgrade all kinds of problems that I have worked through, this one remains though.
My current environment:
Ionic:
Ionic CLI : 6.17.0 (C:\Users\rolin\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : ionic1 1.3.4
@ionic/v1-toolkit : 3.2.20
Cordova:
Cordova CLI : 12.0.0 ([email protected])
Cordova Platforms : android 13.0.0
Cordova Plugins : no whitelisted plugins (8 plugins total)
Utility:
cordova-res : 0.15.4
native-run : 1.7.1
System:
Android SDK Tools : 26.1.1 (C:\Users\rolin\AppData\Local\Android\sdk)
NodeJS : v22.16.0 (C:\Program Files\nodejs\node.exe)
npm : 11.4.1
OS : Windows 10