Wednesday, 13 January 2021

AAPT: error: attribute android:requestLegacyExternalStorage not found

 

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.

Add this to build.gradle

subprojects {

    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 29
                buildToolsVersion "29.0.2"
            }
        }
    }
}


android:requestLegacyExternalStorage="true" to <application> tag in AndroidManifest.xml