我需要一些幫助來解決我的聊天應用程序面臨的問題。一切都很順利,但我把這個項目擱置了months.And當我再次開始工作時,我不得不升級所有的包和flutter本身,以便它能工作。但我不知道為什么會發生這種錯誤,這里是完整的錯誤:
任務':app:processDebugResources'.執行失敗>執行com.android.build.gradle.internal.tasks.Workers$ActionFacadeAndroid資源鏈接失敗D:\MyAppName2.0\myappname\build\app\intermediates\packaged_manifests\debug\AndroidManifest.xml:19:AAPT:錯誤:資源mipmap/ic_launcher(又名com.example.MyAppName:mipmap/ic_launcher)未找到。
我沒有試圖改變圖標的任何名稱或其他任何東西,所以如果有人能幫助我,那將是非常棒的。這是我的pubspec.yaml文件和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
以及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>
如果您需要查看其他文件,這絕對沒有問題!謝謝
這是因為flutter發生了變化。簡單的方法是創建一個同名的新項目,然后將舊文件(庫、資產或其他)復制到剛剛創建的項目中