Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Android compilation error. 1: Task failed with an exception. #43

Open
oleglatypov opened this issue May 11, 2022 · 3 comments
Open

Comments

@oleglatypov
Copy link

oleglatypov commented May 11, 2022

After installing cordova-plugin-browsertab plugin. I can not generate an Android build because following issues:


1: Task failed with an exception.
-----------
* Where:
Script '/platforms/android/cordova-plugin-browsertab/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'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle

Here is app-BrowserTab.gradle:


if(cdvMinSdkVersion == null) {
    ext.cdvMinSdkVersion = minSdkVersion;
} else if (cdvMinSdkVersion.toInteger() < minSdkVersion) {
    ext.cdvMinSdkVersion = minSdkVersion;
}

config.xml

    <preference name="AndroidXEnabled" value="false" />
    <preference name="ScrollEnabled" value="false" />
    <preference name="android-minSdkVersion" value="22" />
    <preference name="android-targetSdkVersion" value="30" />
    <preference name="android-compileSdkVersion " value="30" />

package.json

    "cordova-plugin-browsertab": "^0.2.0",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-inappbrowser": "^5.0.0",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^5.0.0",
    "cordova-plugin-music-controls2": "^3.0.6",
    "cordova-plugin-splashscreen": "^6.0.0",
    "cordova-plugin-statusbar": "^3.0.0",

Its successful if target=android-29 when I change to target=android-30 issue spotted.

Can Someone help me?

@benoitbzl
Copy link

benoitbzl commented Jun 2, 2022

Hello,
I am facing the same issue. Does someone find a fix / workaround for that error?

Cordova 11
cordova-android 10.1.2

@benoitbzl
Copy link

A workaround could be to set the variable at the command line or as an environment variable (see https://cordova.apache.org/docs/en/11.x/guide/platforms/android/index.html#setting-gradle-properties)

@danieldanielecki
Copy link

Adding cdvMinSdkVersion=21 inside gradle.properties fixed this problem for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants