提问人:Khandakar Rashed Hassan 提问时间:10/23/2023 最后编辑:Khandakar Rashed Hassan 更新时间:10/23/2023 访问量:67
无法获取类型为 org.gradle.api.Project 的项目“:app”的未知属性“cdvMinSdkVersion”
Could not get unknown property 'cdvMinSdkVersion' for project ':app' of type org.gradle.api.Project
问:
所以我有一个旧的 Cordova 项目,我想升级到 Android 12。但是,即使我将cdvMinSdkVersion作为构建参数传递,我在构建它时也得到了未知属性“cdvMinSdkVersion”。这是命令,
$cordovaPrefs = @("android-minSdkVersion", "26"), @("android-targetSdkVersion", "33"), @("android-compileSdkVersion", "33"), @("Orientation", "portrait"), @("SplashScreen", "screen"), @("AutoHideSplashScreen", "false"), @("FadeSplashScreenDuration", 800)
for ($i = 0; $i -lt $cordovaPrefs.length; $i++) {
$prefElement = $cordovaConfig.createElement("preference")
$prefName = $cordovaConfig.createAttribute("name")
$prefName.Value = $cordovaPrefs[$i][0]
$prefElement.Attributes.Append($prefName)
$prefValue = $cordovaConfig.createAttribute("value")
$prefValue.Value = $cordovaPrefs[$i][1]
$prefElement.Attributes.Append($prefValue)
$cordovaConfig.widget.AppendChild($prefElement)
}
这是 browsertabs 的插件命令,cordova plugin add https://github.com/Qbix/cordova-plugin-browsertabs.git --save
还有 build 命令,cordova build android --release -- --keystore=****** --storePassword=******** --alias=safeprofile --password=*********
这是完整的错误,
Script
'~app\android\app\platforms\android\cordova-plugin-browsertabs\app-BrowserTab.gradle'
line: 3
* What went wrong:
A problem occurred evaluating script.
> Could not get unknown property 'cdvMinSdkVersion' for project ':app' of type org.gradle.api.Project.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Command failed with exit code 1: ~app\android\app\platforms\android\gradlew -b
!app\android\app\platforms\android\build.gradle cdvBuildDebug
由于 Cordova 生成的 build.gradle,我无法对其进行编辑。其他插件也会发生此错误。 任何帮助都将得到极大的重视。
cdvMinSdkVersion 在 config.xml 中生成,如下所示,
<preference name="android-minSdkVersion" value="26" xmlns="" />
<preference name="android-targetSdkVersion" value="33" xmlns="" />
<preference name="android-compileSdkVersion" value="33" xmlns="" />
此外,这些是我在cdv-gradle-config.json文件中获得的值,
"MIN_SDK_VERSION":26,"SDK_VERSION":33,"COMPILE_SDK_VERSION":33,
答: 暂无答案
评论