0

i was working on a project, everything was fine but when i tried to run the app, i couldn't,i guess because i'm using a bundled version of google play services. so i i made sure that i update android studio and install the lastest google repository. but it still wouldn't work. And when i click on install Repostiroy and sync project, still nothing happens.

please help me : this is my gradle ;

apply plugin: 'com.android.application'

 android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "com.example.nefissa.pfe2"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner       "android.support.test.runner.AndroidJUnitRunner"
 }
  buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',     {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.google.android.gms:play-services:25.1.0'

testCompile 'junit:junit:4.12'
}

please where did i go wrong?

a screenshot;please what can i do? the click on install wouldn't work

Nessy
  • 103
  • 2
  • 7

2 Answers2

1

replace it with compile 'com.google.android.gms:play-services:10.2.0'

and add apply plugin: 'com.google.gms.google-services' on the bottom of your gradle,

and make sure you added classpath 'com.google.gms:google-services:3.0.0' in the Top-level build.gradle file

Badr
  • 294
  • 1
  • 3
  • 14
  • can you please edit my code so i know exactly where to put these? i don't want to mess it up more ! thank you . – Nessy Apr 01 '17 at 22:37
  • check the edit and make sure you add those three lines of code in the proper place and your sdk is up to date – Badr Apr 01 '17 at 22:48
  • Error:Execution failed for task ':app:processDebugGoogleServices'. > File google-services.json is missing. The Google Services Plugin cannot function without it. Searched Location: C:\Users\nefissa\AndroidStudioProjects\PFE2\app\src\debug\google-services.json C:\Users\nefissa\AndroidStudioProjects\PFE2\app\google-services.json – Nessy Apr 01 '17 at 22:53
  • when you create a project on google developers console it creates this file (google-services.json) for you and you should download it and add it to your project in app directory – Badr Apr 02 '17 at 09:34
0

There might one of these problems can cause this issue, try any one of them.

Solution 1:

Try to updated the gradle plugin.

dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
}

Then just Build->Clean project and everything works again.

Solution 2:

Go to the main module in your project, it's usually have the name app.

Then go to > Open Module Settings > in Properties change the Build Tools Version to 25.0.1

Then to make sure open the build.gradle file, and change compileSDKVersion & buildToolsVersion to 25 and 25.0.1 respectively.

If the above solution doesnt work.

Solution 3:

From this answer

"build cache" is enabled by default in build Android Plugin since 2.3.0. It creates files in build cache outside of project folder (e.g. in \Users\%username%.android\build-cache). Theese files are intended to be common between your projects.

And then Android Studio is unable to navigate in theese files.

You can disable Build Cache in gradle.properties file. just add android.enableBuildCache=false

Community
  • 1
  • 1
danglingpointer
  • 4,708
  • 3
  • 24
  • 42