AAPT: error: unknown element <uses-feature> found in debug Manifest
AAPT: error: unknown element <uses-feature> found in debug Manifest
我开始使用 AAPT2 是因为出于某种原因,我的应用程序在相机上不断崩溃,我可能已经从它告诉我的内容中发现了错误:
android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:43: AAPT: error: unknown element <uses-feature> found.
android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:47: AAPT: error: unknown element <uses-permission> found.
android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:48: AAPT: error: unknown element <uses-permission> found.
这是调试清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="26" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<meta-data
android:name="android.support.VERSION"
android:value="25.3.1" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:name="com.myapp.MainApplication"
android:allowBackup="true"
android:debuggable="true"
android:icon="@mipmap/ic_launcher"
android:label="myapp"
android:theme="@style/AppTheme" >
<activity
android:name="com.myapp.MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="myapp"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
**<!-- Problem Occurs Here -->**
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<activity
android:name="cn.finalteam.rxgalleryfinal.ui.activity.MediaActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/Theme_Light.Default" />
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme_Light.Default" />
<provider
android:name="com.imagepicker.FileProvider"
android:authorities="com.myapp.provider"
android:exported="false"
android:grantUriPermissions="true" >
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<meta-data
android:name="com.dylanvann.fastimage.OkHttpProgressGlideModule"
android:value="GlideModule" />
</application>
</manifest>
我查看了其他与我类似的问题,发现您必须删除上述行或将其放在其他地方。但是我不熟悉 XML 的位置,我可能会导致更多问题。谁能帮我解决这个问题?谢谢!
源代码清单:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".MainApplication"
android:label="myapp"
android:icon="@mipmap/ic_launcher"
android:allowBackup="true"
tools:replace="label"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="myapp"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
将 <uses-feature android:name="android.hardware.camera" android:required="true" />
移到 <application>
标签之外,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
...
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<application
android:name="com.myapp.MainApplication"
android:allowBackup="true"
android:debuggable="true"
android:icon="@mipmap/ic_launcher"
android:label="myapp"
android:theme="@style/AppTheme" >
...
</application>
</manifest>
我开始使用 AAPT2 是因为出于某种原因,我的应用程序在相机上不断崩溃,我可能已经从它告诉我的内容中发现了错误:
android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:43: AAPT: error: unknown element <uses-feature> found.
android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:47: AAPT: error: unknown element <uses-permission> found.
android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:48: AAPT: error: unknown element <uses-permission> found.
这是调试清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="26" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<meta-data
android:name="android.support.VERSION"
android:value="25.3.1" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:name="com.myapp.MainApplication"
android:allowBackup="true"
android:debuggable="true"
android:icon="@mipmap/ic_launcher"
android:label="myapp"
android:theme="@style/AppTheme" >
<activity
android:name="com.myapp.MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="myapp"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
**<!-- Problem Occurs Here -->**
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<activity
android:name="cn.finalteam.rxgalleryfinal.ui.activity.MediaActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/Theme_Light.Default" />
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme_Light.Default" />
<provider
android:name="com.imagepicker.FileProvider"
android:authorities="com.myapp.provider"
android:exported="false"
android:grantUriPermissions="true" >
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
<meta-data
android:name="com.dylanvann.fastimage.OkHttpProgressGlideModule"
android:value="GlideModule" />
</application>
</manifest>
我查看了其他与我类似的问题,发现您必须删除上述行或将其放在其他地方。但是我不熟悉 XML 的位置,我可能会导致更多问题。谁能帮我解决这个问题?谢谢!
源代码清单:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".MainApplication"
android:label="myapp"
android:icon="@mipmap/ic_launcher"
android:allowBackup="true"
tools:replace="label"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="myapp"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
将 <uses-feature android:name="android.hardware.camera" android:required="true" />
移到 <application>
标签之外,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
...
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<application
android:name="com.myapp.MainApplication"
android:allowBackup="true"
android:debuggable="true"
android:icon="@mipmap/ic_launcher"
android:label="myapp"
android:theme="@style/AppTheme" >
...
</application>
</manifest>