本文介绍了AAPT:错误:未找到属性 android:requestLegacyExternalStorage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AndroidManifest.xml 中的集合错误

collection error in AndroidManifest.xml

AAPT:错误:未找到属性 android:requestLegacyExternalStorage.

AAPT: error: attribute android:requestLegacyExternalStorage not found.

虽然属性在那里但是写了一个错误

Although the attribute is there but it writes an error

我的 AndroidManifest.xml

My AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>

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

<uses-feature android:name="android.hardware.wifi" android:required="false" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

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

<application
    android:allowBackup="true"
    android:fullBackupContent="true"
    android:icon="@mipmap/launcher_icon"
    android:label="@string/app_name"
    android:requestLegacyExternalStorage="true"
    android:roundIcon="@mipmap/launcher_icon"
    android:supportsRtl="true"
    android:theme="@style/Theme.MaterialFiles"
    tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">

    <activity
        android:name="android.apps.filelist.FileListActivity"
        android:label="@string/file_list_title"
        android:theme="@style/Theme.MaterialFiles.TransparentStatusBar"
        android:visibleToInstantApps="true"
        tools:ignore="UnusedAttribute">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter tools:ignore="AppLinkUrlError">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="inode/directory" />
            <data android:mimeType="resource/folder" />
            <data android:mimeType="vnd.android.document/directory" />
        </intent-filter>
        <!-- @see android.apps.file.MimeTypes#isSupportedArchive(String) -->
        <!--
          ~ We don't really support content URI archives.
          ~ TODO: Figure out a good way to allow choosing this activity only in our app, or
          ~ support content URI archives.
        <intent-filter tools:ignore="AppLinkUrlError">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="application/gzip" />
            <data android:mimeType="application/java-archive" />
            <data android:mimeType="application/rar" />
            <data android:mimeType="application/zip" />
            <data android:mimeType="application/vnd.android.package-archive" />
            <data android:mimeType="application/vnd.debian.binary-package" />
            <data android:mimeType="application/x-7z-compressed" />
            <data android:mimeType="application/x-bzip2" />
            <data android:mimeType="application/x-compress" />
            <data android:mimeType="application/x-cpio" />
            <data android:mimeType="application/x-deb" />
            <data android:mimeType="application/x-debian-package" />
            <data android:mimeType="application/x-gtar" />
            <data android:mimeType="application/x-gtar-compressed" />
            <data android:mimeType="application/x-java-archive" />
            <data android:mimeType="application/x-lzma" />
            <data android:mimeType="application/x-tar" />
            <data android:mimeType="application/x-xz" />
        </intent-filter>
        -->
        <!-- @see https://android.googlesource.com/platform/packages/apps/DocumentsUI/+/master/AndroidManifest.xml -->
        <intent-filter>
            <action android:name="android.intent.action.OPEN_DOCUMENT" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.OPENABLE" />
            <data android:mimeType="*/*" />
        </intent-filter>
        <!--
          ~ Unusable until we implement DocumentsProvider.
        <intent-filter>
            <action android:name="android.intent.action.CREATE_DOCUMENT" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.OPENABLE" />
            <data android:mimeType="*/*" />
        </intent-filter>
        -->
        <intent-filter>
            <action android:name="android.intent.action.GET_CONTENT" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.OPENABLE" />
            <data android:mimeType="*/*" />
        </intent-filter>
        <!--
          ~ Unusable until we implement DocumentsProvider.
        <intent-filter>
            <action android:name="android.intent.action.OPEN_DOCUMENT_TREE" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        -->
        <intent-filter>
            <action android:name="android.apps.intent.action.VIEW_DOWNLOADS" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <meta-data
            android:name="android.app.shortcuts"
            android:resource="@xml/shortcuts" />
    </activity>

    <activity
        android:name="android.apps.filelist.OpenFileAsDialogActivity"
        android:autoRemoveFromRecents="true"
        android:icon="@drawable/open_as_icon"
        android:label="@string/file_open_as_title"
        android:theme="@style/Theme.MaterialFiles.Translucent" />

    <activity
        android:name="android.apps.ftpserver.FtpServerActivity"
        android:label="@string/ftp_server_title"
        android:launchMode="singleTop"
        android:theme="@style/Theme.MaterialFiles">
        <intent-filter>
            <action android:name="android.apps.intent.action.MANAGE_FTP_SERVER" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="android.apps.filelist.FileListActivity" />
    </activity>

    <activity
        android:name="apps.settings.SettingsActivity"
        android:label="@string/settings_title"
        android:launchMode="singleTop"
        android:theme="@style/Theme.MaterialFiles">
        <intent-filter>
            <action android:name="android.intent.action.APPLICATION_PREFERENCES" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="android.apps.filelist.FileListActivity" />
    </activity>

    <activity
        android:name="android.apps.settings.StandardDirectoriesActivity"
        android:label="@string/settings_standard_directories_title"
        android:launchMode="singleTop"
        android:theme="@style/Theme.MaterialFiles">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="android.apps.settings.SettingsActivity" />
    </activity>

    <activity
        android:name="android.apps.settings.BookmarkDirectoriesActivity"
        android:label="@string/settings_bookmark_directories_title"
        android:launchMode="singleTop"
        android:theme="@style/Theme.MaterialFiles">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="android.apps.settings.SettingsActivity" />
    </activity>

    <activity
        android:name="android.apps.about.AboutActivity"
        android:label="@string/about_title"
        android:launchMode="singleTop"
        android:theme="@style/Theme.MaterialFiles">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.filemanagere.android.apps.filelist.FileListActivity" />
    </activity>

    <activity
        android:name="android.apps.filejob.FileJobActionDialogActivity"
        android:autoRemoveFromRecents="true"
        android:theme="@style/Theme.MaterialFiles.Translucent" />

    <activity
        android:name="android.apps.filejob.FileJobConflictDialogActivity"
        android:autoRemoveFromRecents="true"
        android:theme="@style/Theme.MaterialFiles.Translucent" />

    <activity
        android:name="android.apps.viewer.text.TextEditorActivity"
        android:label="@string/text_editor_title"
        android:theme="@style/Theme.MaterialFiles">
        <intent-filter tools:ignore="AppLinkUrlError">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="application/ecmascript" />
            <data android:mimeType="application/javascript" />
            <data android:mimeType="application/json" />
            <data android:mimeType="application/typescript" />
            <data android:mimeType="application/x-sh" />
            <data android:mimeType="application/x-shellscript" />
            <data android:mimeType="application/xml" />
            <data android:mimeType="text/*" />
        </intent-filter>
    </activity>

    <activity
        android:name="android.apps.viewer.image.ImageViewerActivity"
        android:label="@string/image_viewer_title"
        android:theme="@style/Theme.MaterialFiles.Immersive">
        <intent-filter tools:ignore="AppLinkUrlError">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="image/*" />
        </intent-filter>
    </activity>

    <service android:name="android.apps.filejob.FileJobService" />

    <service android:name="android.apps.ftpserver.FtpServerService" />

    <provider
        android:name="android.apps.AppProvider"
        android:authorities="@string/app_provider_authority"
        android:exported="false" />

    <provider
        android:name="android.apps.file.FileProvider"
        android:authorities="@string/file_provider_authority"
        android:exported="false"
        android:grantUriPermissions="true" />

    <receiver android:name="android.apps.filejob.FileJobReceiver" />

    <receiver android:name="android.apps.ftpserver.FtpServerReceiver" />

    <meta-data
        android:name="firebase_crashlytics_collection_enabled"
        android:value="false" />

    <!-- We need to reference a MD2 theme in XML for R8 to keep relevant resources. -->
    <activity
        android:name=".KeepMd2Resources"
        android:theme="@style/Theme.MaterialFiles.Md2" />
</application>

Знаете кого-нибудь, кто может ответить?ошибка сбора в AndroidManifest.xml

Знаете кого-нибудь, кто может ответить?ошибка сбора в AndroidManifest.xml

AAPT:ошибка:атрибут android:requestLegacyExternalStorage не найден.

AAPT: ошибка: атрибут android: requestLegacyExternalStorage не найден.

对于离子开发者,请参考这个答案来解决这个问题:https://stackoverflow.com/a/65595715/10533962

For ionic developers please refer to this answer to fix this issue:https://stackoverflow.com/a/65595715/10533962

推荐答案

(Material Files 作者在此)

(Material Files author here)

您需要针对 SDK 29 进行编译,并且可能使用 aapt 的最新构建工具来了解此属性,因为它是在 Android 10 中引入的.

You need to compile against SDK 29 and maybe use the most recent build tools for aapt to know this attribute, because it's introduced in Android 10.

这篇关于AAPT:错误:未找到属性 android:requestLegacyExternalStorage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 10:36