Cordova Android配置
我正在使用Cordova应用程序,并试图更改CDV-Gradle-Condig.json中的值 但是,每当我从命令行运行应用程序时,它会一直返回默认值:
cordova run android
尤其是我尝试更新AGP_Version,因为它似乎是App Gradle的插件版本
{
"MIN_SDK_VERSION": 22,
"SDK_VERSION": 30,
"GRADLE_VERSION": "7.1.1",
"MIN_BUILD_TOOLS_VERSION": "30.0.3",
"AGP_VERSION": "4.2.2", <--//How can I change this??
"KOTLIN_VERSION": "1.6.10",
"ANDROIDX_APP_COMPAT_VERSION": "1.3.1",
"ANDROIDX_WEBKIT_VERSION": "1.4.0",
"GRADLE_PLUGIN_GOOGLE_SERVICES_VERSION": "4.3.8",
"IS_GRADLE_PLUGIN_GOOGLE_SERVICES_ENABLED": false,
"IS_GRADLE_PLUGIN_KOTLIN_ENABLED": true
}
dependencies {
// Android Gradle Plugin (AGP) Build Tools
classpath "com.android.tools.build:gradle:${cordovaConfig.AGP_VERSION}"
}
。 :
distributionUrl=https://services.gradle.org/distributions/gradle-7.4-bin.zip
如果我手动更改值并从AndroidStudio运行该应用程序,但是从命令行中,它只是返回到默认值,而构建失败!
I am working on a Cordova app and trying to change values in the cdv-gradle-condig.json
but it keeps return to default whenever i run the app from command line:
cordova run android
Especcially I am trying to update the AGP_VERSION as it seems to be the app gradle's plugin version
{
"MIN_SDK_VERSION": 22,
"SDK_VERSION": 30,
"GRADLE_VERSION": "7.1.1",
"MIN_BUILD_TOOLS_VERSION": "30.0.3",
"AGP_VERSION": "4.2.2", <--//How can I change this??
"KOTLIN_VERSION": "1.6.10",
"ANDROIDX_APP_COMPAT_VERSION": "1.3.1",
"ANDROIDX_WEBKIT_VERSION": "1.4.0",
"GRADLE_PLUGIN_GOOGLE_SERVICES_VERSION": "4.3.8",
"IS_GRADLE_PLUGIN_GOOGLE_SERVICES_ENABLED": false,
"IS_GRADLE_PLUGIN_KOTLIN_ENABLED": true
}
dependencies {
// Android Gradle Plugin (AGP) Build Tools
classpath "com.android.tools.build:gradle:${cordovaConfig.AGP_VERSION}"
}
In addition, I also try to update gradle distribution url from gradle-wrapper.properties:
distributionUrl=https://services.gradle.org/distributions/gradle-7.4-bin.zip
If I change the values manually and run the app from AndroidStudio it stays, but from command line it just returns to default and the build fails!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以通过AndroidGradlePluginversion偏好在Config.xml中指定AGP版本或AndroidGooglePlugin。即:
hth
The AGP version or AndroidGooglePlugin can be specified in config.xml through AndroidGradlePluginVersion preference. i.e:
HTH
编辑
cordova
/node_modules/cordova-android/framework/framework/
edit cdv-gradle-config-defaults.json
in
cordova/node_modules/cordova-android/framework/