Reputation: 35
I need some help to fix that issue I'm facing with my chat app. Everything was working great but I left aside the project for some months.And when I started working on it again,I had to upgrade all the packages and flutter itself so that in hope it works. But I don't know why this error occurs, here the complete error :
Execution failed for task ':app:processDebugResources'.> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Android resource linking failed D:\MyAppName 2.0\myappname\build\app\intermediates\packaged_manifests\debug\AndroidManifest.xml:19: AAPT: error: resource mipmap/ic_launcher (aka com.example.MyAppName:mipmap/ic_launcher) not found.
I didn't tried to change any name of icon or anything else, so if someone could help me it will be wonderful. Here are my pubspec.yaml file and my AndroidManifest.xml :
name: MyAppName
description: A new Flutter project.
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.4
flutter_svg: ^1.0.3
emoji_picker: ^0.1.0
shared_preferences: ^0.5.4+1
camera: ^0.9.4+10
path_provider: ^2.0.2
path:
video_player: ^2.1.6
socket_io_client: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
uses-material-design: true
fonts:
- family: OpenSans
fonts:
- asset: fonts/OpenSans-Bold.ttf
- asset: fonts/OpenSans-Regular.ttf
- asset: fonts/OpenSans-Italic.ttf
style: italic
And the AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.MyAppName"
android:versionCode="1"
android:versionName="1.0.0" >
<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="31" />
<!--
Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
android:debuggable="true"
android:icon="@mipmap/ic_launcher"
android:label="MyAppName"
android:usesCleartextTraffic="true" >
<activity
android:name="com.example.MyAppName.MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize" >
<!--
Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI.
-->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
<!--
Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame.
-->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java
-->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<uses-library
android:name="androidx.window.extensions"
android:required="false" />
<uses-library
android:name="androidx.window.sidecar"
android:required="false" />
</application>
</manifest>
If you need other files to see, there is absolutely no problem ! Thanks
Upvotes: 2
Views: 6196
Reputation: 577
Solution: Import the icons from main: Right click on mipmap -> new -> ImageAsset -> choose the image -> save to main
IF these is still the problem, Right click on mipmap -> Open in -> Eplorer. Then, copy
Upvotes: 0
Reputation: 71
I had the same problem, I was importing the icons using:
Android Studio -> new -> ImageAsset -> choose the image
But when saving it, I didn't noticed they gave me 3 options to save: debug, main or release. I was saving in debug, that's why when I went to compile, it didn't search in debug but in main instead.
Solution: Import the icons from main:
Android Studio -> new -> ImageAsset -> choose the image -> save to main
Upvotes: 7
Reputation: 474
it happens because there is a change in flutter. the easy way is to create a new project with the same name, then copy the old files (lib, assets or others) into the project you just created
Upvotes: 1