App not installing on both device and emulator


#1

My application was building and running on an emulator and a device. I got a new device today with Android 4.4.2 and as I debug the problem of file///*index.html not found I did couple of installation and now the app will not build. I am getting the error below

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/some_path/platforms/android/build.gradle’ line: 260

  • What went wrong:
    A problem occurred evaluating root project ‘android’.

Could not get unknown property ‘GOOGLE_PLAY_SERVICES_VERSION’ for object of type org.gradle.api.internal.artif
acts.dsl.dependencies.DefaultDependencyHandler.

In trying to solve this problem, I checked the generated .gradle file and found the two at line 259 and 260.

 compile "com.google.android.gms:play-services-location:+"
 compile "com.google.android.gms:play-services-location:$GOOGLE_PLAY_SERVICES_VERSION"

I have installed Google Play Service version 46 and all looks fine. The output of ionic info is attached below.

cli packages: (/some_path/learningIonic/Jollof/node_modules)

@ionic/cli-utils  : 1.18.0
ionic (Ionic CLI) : 3.18.0

global packages:

cordova (Cordova CLI) : 7.0.1

local packages:

@ionic/app-scripts : 2.0.2
Cordova Platforms  : android 6.2.3 ios 4.5.4
Ionic Framework    : ionic-angular 3.5.3

System:

Android SDK Tools : 26.1.1
Node              : v8.1.3
npm               : 5.0.3
OS                : Linux 4.4

#2

+1 Also having the same issue.


#3

+1

Comparing to old versions of the gradle file, the line should just read

compile “com.google.android.gms:play-services-location:+”

and

$GOOGLE_PLAY_SERVICES_VERSION

are in fact defined in
image

So it looks like some substitution is failing

I have upgraded everything to latest version


#4

Fixed it by reverting to an old version of project.json in the plugin/android directory


#5

I have also done similar, I removed the platform folders then added them again. Also make sure you have Google Play Service installed in your Sdk Manager.


#6

Thanks! Also got mine working by removing and re-adding.

For anyone else, quick reminder:
ionic cordova platform remove android
ionic cordova platform add android

Also, since I had just added Google Play Services through Android SDK Manager, as suggested, I was getting an “Error: spawn EACCES” due to folder permission. A chmod fixed this:
chmod 755 /Applications/Android\ Studio.app/Contents/gradle/gradle-4.1/bin/gradle