简体   繁体   English

AndroidManifest 给了我多个错误

[英]AndroidManifest is givin me multiple error

I am having multiple error regarding following AndroidManifest.xml these are the error.我在关注 AndroidManifest.xml 时遇到多个错误,这些都是错误。 I am flutter bigginer, and couldn't understand reading similer posts.我是个大人物,无法理解阅读类似的帖子。

・Attribute android:usesCleartextTraffic is not allowed here・这里不允许使用属性 android:usesCleartextTraffic

・Attribute android:icon is not allowed here・这里不允许使用属性 android:icon

・Unresolved class 'MainActivity'・未解决的类“MainActivity”

・Attribute android:launchMode is not allowed here・这里不允许使用属性 android:launchMode

・Attribute android:theme is not allowed here・属性 android:theme 不允许在这里

・Attribute android:configChanges is not allowed here・这里不允许使用属性 android:configChanges

・Attribute android:hardwareAccelerated is not allowed here・这里不允许使用 android:hardwareAccelerated 属性

・Attribute android:windowSoftInputMode is not allowed here・这里不允许使用属性 android:windowSoftInputMode

What I have tried so far is invalidate cache and remove all of them and re-add lines.到目前为止,我尝试的是使缓存无效并删除所有缓存并重新添加行。 Do you know what is to be fixed?你知道要修复什么吗? this code below is renewed version after two kind people gave me coments:)下面的代码是两个好心人给我评论后的更新版本:)

 <?xml version="1.0" encoding="utf-8"?>
    <manifest
            xmlns:android="http://schemas.android.com/apk/res/android"
            package="com.packagename">
      <uses-permission android:name="android.permission.INTERNET" />
      <application android:label="@string/activity_name" android:usesCleartextTraffic="true" android:icon="@mipmap/ic_launcher">
        <activity android:name=".MainActivity" 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">
          <meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
          <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>
          <meta-data android:name="flutterEmbedding" android:value="2"/>
        </activity>
      </application>
    </manifest>

Your manifest should look something like this您的清单应如下所示

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:versionCode="1"
    android:versionName="1.0">

    <!-- Beware that these values are overridden by the build.gradle file -->
    <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="26" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <!-- This name is resolved to com.example.myapp.MainActivity
             based upon the namespace property in the `build.gradle` file -->
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

Unfortunately you have placed most of your property in disarray不幸的是,你把你的大部分财产都弄得一团糟

The Error is in the application name.错误在应用程序名称中。 The line android:name="${applicationName} is not a valid statement or it has no access to the variable applicationName . Make a note that applicationName must be a string.android:name="${applicationName}不是一个有效的语句,或者它无法访问变量applicationName 。请注意applicationName必须是一个字符串。

Check out the docs: https://developer.android.com/guide/topics/manifest/application-element查看文档: https ://developer.android.com/guide/topics/manifest/application-element

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM