Android / Cordova 构建:如何更改 minSdk?
Android / Cordova build : how to change minSdk?
我想在 Play 商店发布一个应用程序,并使其无法访问 android < 7.0 / API 级别 24
此应用是 Ionic/Cordova 应用
我第一次发布它时,没有触及任何东西,得到了 API 22+ 级。
现在我尝试将其设置为 24+。
我尝试了很多东西:
- 将 androidManifest.xml 更改为
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="29" />
:应用程序无法构建,日志为 The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
- android/build.gradle :如果我更改
defaultMinSdkVersion=22
的默认值,应用程序会构建但不会安装
- android/gradle.properties : 有一个
cdvMinSdkVersion
,但它已经设置为 24
- config.xml -
<preference name="android-minSdkVersion" value="24" />
: 应用程序构建,可以安装调试构建但“--prod --release” buld 不会安装
应用程序无法安装时,仍然可以在模拟器或设备上 运行,这实际上是 apk 的安装失败:我怎样才能获得一些日志?
编辑:如 Marco 的回答所述,config.xml 是必须更改的文件。
apk 无法安装,因为用于创建它的过程,在使用 adb install 安装时看到它。按照离子文档,我正在使用 jarsigner + zipalign 构建,但我必须先 zipalign(两次)然后是 apksigner。
不知道为什么有些 apk 构建没问题。
正确的解决方案是更改config.xml
文件。为什么 ? /android/
下的所有内容均由 Cordova 构建,将在下一次构建期间修改 and/or 删除。
您可能会调查为什么该应用无法在 --prod --release
中安装。如果您在debug和release中有不同的证书,您需要先卸载旧应用再安装新应用。
我想在 Play 商店发布一个应用程序,并使其无法访问 android < 7.0 / API 级别 24
此应用是 Ionic/Cordova 应用
我第一次发布它时,没有触及任何东西,得到了 API 22+ 级。 现在我尝试将其设置为 24+。
我尝试了很多东西:
- 将 androidManifest.xml 更改为
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="29" />
:应用程序无法构建,日志为The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
- android/build.gradle :如果我更改
defaultMinSdkVersion=22
的默认值,应用程序会构建但不会安装 - android/gradle.properties : 有一个
cdvMinSdkVersion
,但它已经设置为 24 - config.xml -
<preference name="android-minSdkVersion" value="24" />
: 应用程序构建,可以安装调试构建但“--prod --release” buld 不会安装
应用程序无法安装时,仍然可以在模拟器或设备上 运行,这实际上是 apk 的安装失败:我怎样才能获得一些日志?
编辑:如 Marco 的回答所述,config.xml 是必须更改的文件。
apk 无法安装,因为用于创建它的过程,在使用 adb install 安装时看到它。按照离子文档,我正在使用 jarsigner + zipalign 构建,但我必须先 zipalign(两次)然后是 apksigner。 不知道为什么有些 apk 构建没问题。
正确的解决方案是更改config.xml
文件。为什么 ? /android/
下的所有内容均由 Cordova 构建,将在下一次构建期间修改 and/or 删除。
您可能会调查为什么该应用无法在 --prod --release
中安装。如果您在debug和release中有不同的证书,您需要先卸载旧应用再安装新应用。