大家好,我從 GitHub 克隆的顫振專案中有一個錯誤。我試過這個方法,但沒有奏效
<application
android:name="io.flutter.app.FlutterApplication"
到 :
<application
android:name="${applicationName}"
誰能幫忙?
錯誤:

AndroidManifest.xml:

uj5u.com熱心網友回復:
活動后在android清單中添加以下代碼
<meta-data
android:name="flutterEmbedding"
android:value="2" />

在專案 build.gradle 中,在 buildscript 中添加以下代碼
ext.kotlin_version = '1.6.10'

并在 gradle-wrapper.properties 中更改 gradle 版本

我的清單檔案
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.stackoverflowexample">
<application
android:label="stackoverflowexample"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
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"
/>
<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" />
</application>
</manifest>
uj5u.com熱心網友回復:
AndroidManifest.xml在檔案中添加以下行
<meta-data
android:name="flutterEmbedding"
android:value="2" />
有關更多詳細資訊:https ://docs.flutter.dev/release/break-changes/android-v1-embedding-create-deprecation
uj5u.com熱心網友回復:
這聽起來像是一個虛假的解決方案,但實際上,解決這個問題的最簡單方法是:
- 洗掉
android檔案夾。 - 跑步
flutter create .
該命令將android使用已遷移的代碼重新創建檔案夾。此外,該命令將為其他穩定平臺(例如 web、windows)創建檔案夾,因此您可以忽略這些并洗掉它們或flutter create通過定義 android - 來觸發命令flutter create --platforms=android .。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/445218.html
