迁移到Android Api级别29时,出现此错误,找不到requestLegacyExternalStorage,处理清单失败

问题描述

我必须使用requestLegacyExternalStorage =“ true”来访问我的React Native应用程序中的外部存储,

build.gradle:
   buildToolsversion = "29.0.0"
        minSdkVersion = 23
        compileSdkVersion = 29
        targetSdkVersion = 29
        supportLibVersion = "29.0.0"````
Manifest:
  <application
        tools:targetApi="29"
        tools:ignore="GoogleAppIndexingWarning"
        android:name=".MainApplication"
        android:allowBackup="false"
        android:theme="@style/AppTheme"
        android:requestLegacyExternalStorage="true"
        android:largeHeap="true">````
    
Error:
error: attribute android:requestLegacyExternalStorage not found.
error: Failed processing manifest

解决方法

我通过将子项目compilesdkversion更改为29解决了该错误