简体   繁体   中英

Upgrading to Cordova-Android 10 breaks build.gradle

I'm not allowed to post actual code, but these are more or less the offending lines:

// Set property defaults after extension .gradle files.
if (ext.cdvCompileSdkVersion == null) {
    ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget()
}
if (ext.cdvBuildToolsVersion == null) {
    ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
}

This is the error I get:

Could not find method getLatestInstalledBuildTools() for arguments [] on object of type org.gradle.internal.extensibility.DefaultExtraPropertiesExtension.

This error has only been showing up after I upgraded to cordova-android 10. There seems to have been some issues with fetching the buildtool versions (see https://cordova.apache.org/announcements/2021/07/30/cordova-android-10.0.1.html ), but I upgraded to 10.0.1 and still get that error - has anyone been having this issue? How did you fix it?

In my case i tried to upgrade to cordova-android 10.0.1 (as you do) and also 10.1.1 but nothing worked.

Then I editend my build.gradle like so:

if (ext.cdvBuildToolsVersion == null) {
    ext.cdvBuildToolsVersion = cordovaConfig.BUILD_TOOLS_VERSION
    //ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
    //ext.cdvBuildToolsVersion = project.ext.defaultBuildToolsVersion
}

and the app starts to build again

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM