错误:在 <manifest><application 中找到意外元素<查询>>

error: unexpected element <queries> found in <manifest><application>

提问人:Nio Zihni 提问时间:1/2/2023 最后编辑:Nio Zihni 更新时间:1/2/2023 访问量:237

问:

我在安装 flutter launcher url 时出现错误,我知道这是 gradle 版本问题,但我仍然找不到解决方案,我已经将 gradle 升级到最新版本[[在此处输入图像描述](https://i.stack.imgur.com/Kuefr.jpg)](https://i.stack.imgur.com/er0sw.jpg)

我已将 Gradle 升级到最新版本, 请帮帮我

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.cozy_app">

<uses-permission android:name="android.permission.INTERNET"/>

    <!-- Provide required visibility configuration for API level 30 and above -->
<queries>
  <!-- If your app checks for SMS support -->
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="sms" />
  </intent>
  <!-- If your app checks for call support -->
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="tel" />
  </intent>
</queries>
   <application
        android:label="cozy_app"
        android:name="${applicationName}"
        android:icon="@mipmap/launcher_icon">
        <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" />
        <!-- Provide required visibility configuration for API level 30 and above -->
        <queries>
        <!-- If your app checks for SMS support -->
            <intent>
                <action android:name="android.intent.action.VIEW" />
                <data android:scheme="sms" />
            </intent>
        <!-- If your app checks for call support -->
            <intent>
                <action android:name="android.intent.action.VIEW" />
                <data android:scheme="tel" />
            </intent>
        </queries>
    </application>
</manifest>
```gradle

    
flutter 构建 android-gradle-plugin build.gradle

评论

0赞 Rahul 1/2/2023
你能在这里粘贴AndroidManifest.xml吗?你可以在 <flutter-project>/android/src/main/AndroidManifest 中找到它.xml
0赞 Nio Zihni 1/2/2023
/app/intermediates/packaged_manifests/debug/AndroidManifest.xml:73 中的错误:错误:在 <manifest><application> 中找到意外元素<查询>。

答:

-1赞 Rahul 1/2/2023 #1

您的查询标记应位于活动标记内。

评论

0赞 Nio Zihni 1/2/2023
你能给我看个例子吗?我已经改变了,但它仍然是错误的