Could not find any version that matches com.google

2019-08-30 08:47发布

问题:

I'm trying to compile on ionic 3.20 with cordova 6.5.0 on Android.

I'm executing cordova run android but everytime I'm getting:

Error: ~/Develop/blastbot-ionic/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
 Could not resolve all dependencies for configuration ':_debugApkCopy'.
   > Could not find any version that matches com.google.android.gms:play-services-gcm:12+.
 Versions that do not match:
     11.0.4
     11.0.2
     11.0.1
     11.0.0
     10.2.6
     + 18 more
 Required by:
     :android:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I have all this installed: SDK Manager

I've already tried executing cordova platform rm android & cordova platform rm android@6.2 or cordova platform rm android. Both ending in the same result. Downloaded a million different SDK's versions.

回答1:

I tried cordova platform add android@5 and afterwards cordova run android and it worked like a charm.

UPDATE

The line abov "solved" the issue partially, but my targeted API level was 23 instead of 25. The issue, after almost month and a half of trying different SDK tools/build-tools/Google repo combinations I found the solution.

Navigate to platforms/android/project.properties and look for a line like cordova.system.library.2=com.google.android.gms:play-services-gcm:12+

Notice that 12+ at the end. Simply change it to 11+, that will do the job. Hope nobody goes through this like I did.