如何修复 Android 清单文件中的错误 "Unsupported type 'uses-permission'"
How to fix the error "Unsupported type 'uses-permission'" in the Android Manifest file
我正在学习 Android MySQL 教程 (https://www.simplifiedcoding.net/android-mysql-tutorial-to-perform-basic-crud-operation/#Creating-Helper-Classes),目的是构建连接到 MySQL 数据库的 Android 应用程序在 Apache 服务器上(XAMPP 包)。我使用 Android Studio (3.0.1) 来开发 Android 部分。
当我尝试 运行 我的 Android 清单文件(允许应用程序访问互联网)中的代码时遇到问题。错误是如题中所说的"Unsupported type 'uses-permission'"。我试图寻找常见错误,例如拼写错误,或者我在代码中请求的权限是否确实存在,但我找不到任何有用的方法来修复它。而且我没有在教程的网站上询问,因为看起来我不太可能得到答案(教程的最后一条评论是在 2015 年 10 月 28 日),我也看了评论,似乎没有人有遇到了类似的问题。
这是代码:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ch.jemili.yasmina.myheroapp">
<!-- this is the internet permission -->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<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>
出于某种原因,您的项目 app/src/main/res/values/AndroidManifest.xml
中有一个清单文件。那不是清单的去处。清单进入 app/src/main/AndroidManifest.xml
.
我正在学习 Android MySQL 教程 (https://www.simplifiedcoding.net/android-mysql-tutorial-to-perform-basic-crud-operation/#Creating-Helper-Classes),目的是构建连接到 MySQL 数据库的 Android 应用程序在 Apache 服务器上(XAMPP 包)。我使用 Android Studio (3.0.1) 来开发 Android 部分。
当我尝试 运行 我的 Android 清单文件(允许应用程序访问互联网)中的代码时遇到问题。错误是如题中所说的"Unsupported type 'uses-permission'"。我试图寻找常见错误,例如拼写错误,或者我在代码中请求的权限是否确实存在,但我找不到任何有用的方法来修复它。而且我没有在教程的网站上询问,因为看起来我不太可能得到答案(教程的最后一条评论是在 2015 年 10 月 28 日),我也看了评论,似乎没有人有遇到了类似的问题。
这是代码:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ch.jemili.yasmina.myheroapp">
<!-- this is the internet permission -->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<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>
出于某种原因,您的项目 app/src/main/res/values/AndroidManifest.xml
中有一个清单文件。那不是清单的去处。清单进入 app/src/main/AndroidManifest.xml
.