Ionic Android默认build.gradle设置



在platforms/android/build.gradle中,默认情况下我有以下

allprojects {
repositories {
google()
jcenter()
}
//This replaces project.properties w.r.t. build settings
project.ext {
defaultBuildToolsVersion="28.0.3" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
}
}

由于一些插件,我需要将默认版本、最低版本和其他所有版本升级为:

allprojects {
repositories {
google()
jcenter()
}
//This replaces project.properties w.r.t. build settings
project.ext {
defaultBuildToolsVersion="29.0.0" //String
defaultMinSdkVersion=21 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=30 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=30 //Integer - We ALWAYS compile with the latest by default
}
}

是否可以在不从/platforms更改此文件的情况下更改这些默认值,因为每次删除/添加平台时都会删除此文件?

在config.xml中,我有这样的:

<platform name="android">
<preference name="android-minSdkVersion" value="21" />
<preference name="android-targetSdkVersion" value="30" />
<preference name="android-compileSdkVersion" value="30" />

此外,我在应用程序级文件夹中添加了以下内容:

android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
supportLibVersion = “29.0.0”
}

但它似乎不起作用,在构建过程中,我仍然会收到这个错误:

AAPT: error: attribute android:requestLegacyExternalStorage not found

我有什么东西不见了吗?

谢谢!

如果您在AndroidManifest.xml 中有以下代码

<application android:requestLegacyExternalStorage="true">
<activity android:name="com.yalantis.ucrop.UCropActivity" android:screenOrientation="portrait" android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
</application>

然后删除android:requestLegacyExternalStorage="真">因为它从29.0 开始可用

最新更新