[英]Error in AndroidManifest.xml in Flutter App "Attribute class not Found"
AndroidManifest.xml 在下面的代碼中顯示了 10 個錯誤。 我無法理解為什么會顯示這些錯誤以及如何解決這個問題。 幫助我擺脫這些錯誤。
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.buis_talk">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:requestLegacyExternalStorage="true"
android:label="buis_talk"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:usesCleartextTraffic="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>
錯誤是:-
TLDR
我想如果在Android Studio中單獨打開android文件夾,應該可以正常看到。 (也許,我不確定)。
長答案
Android 打開Flutter
項目時, Studio無法理解Android
內容。
如果是一個簡單的 Android 項目,那么它可以很容易地理解 Gradle 文件和你的 Java/Kotlin。
這對您作為 Flutter 開發人員意味着什么,當您編輯本機 Android 或 iOS 代碼時。 您將無法完成代碼。 Android Studio 將無法告訴您代碼中的錯誤。
Flutter 團隊正在努力解決這個問題。 這樣即使您打開了 Flutter 項目,您也可以擁有所有用於編輯本機代碼的酷 IntelliJ 功能。
另外,我想如果你單獨打開android,那你應該可以正常看到。 (也許,我不確定)。
如果項目在運行時失敗,則如附圖所示; 在第 29 行的末尾錯誤地添加了z
。
項目運行良好,但您擔心代碼是紅色的/錯誤的; 正如@powerman23rus詳細解釋的那樣,請忽略它。
此外,如果第 1 點和第 2 點不適用,那么您必須發布完整的錯誤日志,以便我們追蹤問題的根源。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.