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

Could not get unknown property 'cdvCompileSdkVersion' #821

Closed
3 tasks done
ctfrancia opened this issue Aug 29, 2019 · 8 comments
Closed
3 tasks done

Could not get unknown property 'cdvCompileSdkVersion' #821

ctfrancia opened this issue Aug 29, 2019 · 8 comments

Comments

@ctfrancia
Copy link

Bug Report

Problem

ever since adding google play services I have been following the rabbit holes of this issue and that issue and at this point I have no idea where the error lies. I have been getting the error:

  • What went wrong:
    A problem occurred evaluating project ':com.google.playservices:google-play-services_lib'.
    Could not get unknown property 'cdvCompileSdkVersion' for object of type com.android.build.gradle.LibraryExtension.

after reading files I went and found that downgrading to 6.4.0 solved it. did that got another error, then read the post #485, so I upgraded back to 8.0.0 and still getting the issue.

What is expected to happen?

to compile and run

What does actually happen?

the error above

Information

config.xml

<preference name="android-minSdkVersion" value="19" />
// ...
    <platform name="android">
        <resource-file src="google-services.json" target="google-services.json" />

Command or Code

$ ionic cordova run android --device

Environment, Platform, Device

mac osx

Version information

Ionic:

   Ionic CLI                     : 5.2.7 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.8.1
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.3.1
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.0.0

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0, ios 4.5.5
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 14 other plugins)

Utility:

   cordova-res : 0.6.0 
   native-run  : 0.2.7 (update available: 0.2.8)

System:

   NodeJS : v12.7.0 (/usr/local/lib/node_modules/node/bin/node)
   npm    : 6.10.2
   OS     : macOS Mojave
   Xcode  : Xcode 10.2.1 Build version 10E1001

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@ctfrancia
Copy link
Author

I had a bad plugin installed that was 5 years untouched. I need a drink.

@Shery11
Copy link

Shery11 commented Oct 22, 2019

Hi, getting same error on building an old application. Can you tell which plugin did you remove ?

@ctfrancia
Copy link
Author

I don't remember exactly now, but I think that it was the firebase one which is unmaintained

@jongbonga
Copy link

jongbonga commented Feb 11, 2020

I'm getting the same issue with intercom plugin...
Any solution yet?

@jongbonga
Copy link

1 year later :(

@JorisDebonnet
Copy link

I'm getting the same issue with intercom plugin...
Any solution yet?

I found a workaround, but it's dirty 😕

  1. Intercom's Cordova plugin, even the very most recent one, wants cdvCompileSdkVersion and cdvBuildToolsVersion values, so okay fine, let's created them. They go as extra lines into variables.gradle. The first is simply a copy of the existing compileSdkVersion there, and for the cdvBuildToolsVersion value, I looked up the latest installed version via Tools > SDK Manager > Build tools.
  2. The next thing it complains about is that applicationId is being set by a plugin/library, which is forbidden. This is where it gets dirty, because I could only fix this by editing a file in node_modules. Specifically, I commented out lines 7 and 8 in node_modules/cordova-plugin-intercom/src/android/build-extras-intercom.gradle. Then, Android Studio was happy to build my project, and Intercom works. (This might have bad side-effects if a user has another app with the Intercom plugin. I did not test this.) I added this to my documentation because I'll need to edit that file after each npm command...

I'm sure this is very bad practice etc, probably caused by not understanding what is actually wrong. I hope to solve it better in the future, but it seems to work for now.

@Franco-Alejandro
Copy link

Did anyone find a different fix for this? I'm facing the same issue with the latest intercom package, basically

Could not get unknown property 'cdvBuildToolsVersion' for project ':app' of type org.gradle.api.Project.

For some reason i cannot set this variable from the config.xml

@danieldanielecki
Copy link

danieldanielecki commented Jul 29, 2023

Some outdated packages cause it, such as cordova-plugin-browsertab, see: google/cordova-plugin-browsertab#43.

There are multiple ways to solve this, it's even an example from Cordova docs.

That one working for me - add cdvMinSdkVersion=21 inside gradle.properties. Haven't tried the other ones, but as per cordova-plugin-browsertab#43 (comment), it should work at least with exporting as environmental variable.

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

6 participants