Friday, July 21, 2017

Fix gradle error when building old version of kapsel (SP14) andorid cordova project

When building android cordova project (kapsel sp14) with new version of android sdk, after imported the project into android studio, a few gradle related build errors may be reported. The following steps can be used to fix the error:

1. Open module build.gradle, and remove productFlavors section as empty, this will avoid the NDK error
if (Boolean.valueOf(cdvBuildMultipleApks)) {
    productFlavors {
    }
}

2. in the same build.gradle file, update gradle version and gradle plugin version as the latest one
dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
}


task wrapper(type: Wrapper) {
    gradleVersion = '2.14.1'
}


Another simple way to updating gradle and gradle plugin version is, after importing the project into android studio, select File->Project structure menu and then update the gradle and gradle plugin version the default one used by android studio.

No comments:

Post a Comment