如何在android studio中修复此错误?

如何在android studio中修复此错误?,android,Android,因此,每当我在Android Studio中创建新项目时,都会发生以下情况: activity_main.xml中有4个错误,AndroidManifest.xml中有6个错误 <application android:allowBackup="true"<--ERROR(attribute android:allowBackup is not allowed here) `android:icon="@mipmap/ic_launcher"` <--ERROR(attrib

因此,每当我在Android Studio中创建新项目时,都会发生以下情况: activity_main.xml中有4个错误,AndroidManifest.xml中有6个错误

<application
android:allowBackup="true"<--ERROR(attribute android:allowBackup is not allowed here)
`android:icon="@mipmap/ic_launcher"`  <--ERROR(attribute android:icon is not allowed here)
android:label="@string/app_name"
`android:roundIcon="@mipmap/ic_launcher_round"` <--ERROR(attribute android:roundIcon is not ...)
`android:supportsRtl="true"`  <--ERROR(attribute android:supportsRtl is not ...)
`android:theme="@style/AppTheme">`  <--ERROR(attribute android:theme is not allowed..)
    `<activity android:name=".MainActivity">` <--ERROR(Unresolved class MainActivity)


     <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
这里是活动中心

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
`android:layout_width="match_parent"`    <---ERROR(attribute android:layout_width is not allowed here)
`android:layout_height="match_parent"`    <---ERROR(attribute android:layout_height is not allowed )
`tools:context=".MainActivity">`      <---ERROR(attribute tools:context is not allowed here)

`<TextView`    <---ERROR(attribute TextView is not allowed here)


    android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
<application
android:allowBackup="true"<--ERROR(attribute android:allowBackup is not allowed here)
`android:icon="@mipmap/ic_launcher"`  <--ERROR(attribute android:icon is not allowed here)
android:label="@string/app_name"
`android:roundIcon="@mipmap/ic_launcher_round"` <--ERROR(attribute android:roundIcon is not ...)
`android:supportsRtl="true"`  <--ERROR(attribute android:supportsRtl is not ...)
`android:theme="@style/AppTheme">`  <--ERROR(attribute android:theme is not allowed..)
    `<activity android:name=".MainActivity">` <--ERROR(Unresolved class MainActivity)


     <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


从activity_main.xml文件中删除单引号:

<application
android:allowBackup="true"<--ERROR(attribute android:allowBackup is not allowed here)
`android:icon="@mipmap/ic_launcher"`  <--ERROR(attribute android:icon is not allowed here)
android:label="@string/app_name"
`android:roundIcon="@mipmap/ic_launcher_round"` <--ERROR(attribute android:roundIcon is not ...)
`android:supportsRtl="true"`  <--ERROR(attribute android:supportsRtl is not ...)
`android:theme="@style/AppTheme">`  <--ERROR(attribute android:theme is not allowed..)
    `<activity android:name=".MainActivity">` <--ERROR(Unresolved class MainActivity)


     <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

您只需要启用嵌入式Maven存储库。要执行此操作,请遵循以下路径:

<application
android:allowBackup="true"<--ERROR(attribute android:allowBackup is not allowed here)
`android:icon="@mipmap/ic_launcher"`  <--ERROR(attribute android:icon is not allowed here)
android:label="@string/app_name"
`android:roundIcon="@mipmap/ic_launcher_round"` <--ERROR(attribute android:roundIcon is not ...)
`android:supportsRtl="true"`  <--ERROR(attribute android:supportsRtl is not ...)
`android:theme="@style/AppTheme">`  <--ERROR(attribute android:theme is not allowed..)
    `<activity android:name=".MainActivity">` <--ERROR(Unresolved class MainActivity)


     <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
文件->设置->构建、执行、部署->渐变->Android Studio

<application
android:allowBackup="true"<--ERROR(attribute android:allowBackup is not allowed here)
`android:icon="@mipmap/ic_launcher"`  <--ERROR(attribute android:icon is not allowed here)
android:label="@string/app_name"
`android:roundIcon="@mipmap/ic_launcher_round"` <--ERROR(attribute android:roundIcon is not ...)
`android:supportsRtl="true"`  <--ERROR(attribute android:supportsRtl is not ...)
`android:theme="@style/AppTheme">`  <--ERROR(attribute android:theme is not allowed..)
    `<activity android:name=".MainActivity">` <--ERROR(Unresolved class MainActivity)


     <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
最后选中启用嵌入式Maven存储库

<application
android:allowBackup="true"<--ERROR(attribute android:allowBackup is not allowed here)
`android:icon="@mipmap/ic_launcher"`  <--ERROR(attribute android:icon is not allowed here)
android:label="@string/app_name"
`android:roundIcon="@mipmap/ic_launcher_round"` <--ERROR(attribute android:roundIcon is not ...)
`android:supportsRtl="true"`  <--ERROR(attribute android:supportsRtl is not ...)
`android:theme="@style/AppTheme">`  <--ERROR(attribute android:theme is not allowed..)
    `<activity android:name=".MainActivity">` <--ERROR(Unresolved class MainActivity)


     <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
祝你好运,新投稿人;)

<application
android:allowBackup="true"<--ERROR(attribute android:allowBackup is not allowed here)
`android:icon="@mipmap/ic_launcher"`  <--ERROR(attribute android:icon is not allowed here)
android:label="@string/app_name"
`android:roundIcon="@mipmap/ic_launcher_round"` <--ERROR(attribute android:roundIcon is not ...)
`android:supportsRtl="true"`  <--ERROR(attribute android:supportsRtl is not ...)
`android:theme="@style/AppTheme">`  <--ERROR(attribute android:theme is not allowed..)
    `<activity android:name=".MainActivity">` <--ERROR(Unresolved class MainActivity)


     <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

您是否也从AndroidManifest.xml中删除了它们?什么是错误信息?对不起,我不明白。我必须从androidmainfest.xml中删除什么?或者从activity_main.xml中删除所有符号`如果单词中的符号是指写在这个“(此处)”中的单词,我也会从activity_main和rom mainfest中删除所有符号,然后我只会访问Gradle,之后只有Runner文件。没有Android Studio。怎么办?你在android studio中找不到这个路径?你使用哪个版本的android studio?