When I try to sync the gradle file I keep on getting this error
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.0.0.
Before posting this question I have visited here, because the error was similar to that of mine and according to the accepted answer I removed apply plugin: 'com.google.gms.google-services' and tried to sync it again and the build was successfull, but when I tried to run the app on my device it threw an error
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForDebug'.
I have tried all the answers from this link and even tried to change play service service version 11.0.0 to 11.0.1, but none of them works.
Here is my build.gradle(module) file :
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.hp.passwordStorage"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
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.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.firebase:firebase-auth:11.0.0'
compile 'com.google.firebase:firebase-admin:5.2.0'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
}
Here is my build.gradle(app) file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Can anyone please help me?
Thank you :)
Go to File -> Project Structure
Select 'Project Settings'
Select 'Dependencies' Tab
Click '+' and select '1.Library Dependencies'
Search for : com.google.android.gms:play-services
Select the latest version and click 'OK'
Make sure that you have configured both your root-level Gradle file and module Gradle file (usually the app/build.gradle). Check this guide which can help you on how to integrate the Firebase libraries into your project. Also, the cause of this crash is likely to be the version of Google Play Service installed on the testing device. Make sure that you have the latest Google Play Services version installed on the testing device.
Related
I'm trying to re-install Android Studio 2.2 in my formatted computer. I tried installing 2.3 updated version but I got these same errors. So I tried installing 2.2 . When I open a project with an empty activity, Gradle sync fails showing errors in the Message section, as shown in the image. The code in build.gradle (module:app) is given as: `
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.heenamehta.myapplication"
minSdkVersion 15
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.3.1'
testCompile 'junit:junit:4.12'
}
`
The code in build.gradle (module: project is given as:)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
How can I solve this problem?Messages section Image
Try this :
In Android Studio go to File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
Uncheck the 'Offline work' under 'Global Gradle settings'
Connect the internet and sync.
Update android gradle plugin to latest version
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
}
I updated my android studio and my gradle will not sync
issues it gives me these errors. Im also using firebase as for authorization and database.I have tried deleting the gradle files and rebuilding but that didnt work. any suggestions would be appreciated.
Failed to resolve .com.android.support:support-v4:25.2.0
Failed to resolve com.android.support.test.espresso:espresso-core:2.2.2
Failed to resolve com.android.support:appcompat-v4:25.3.1
Failed to resolve com.android.support:mediarouter-V7:25.2.0
here is the build gradle for the project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
here is my app gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.example.dude.sportspicks518"
minSdkVersion 19
targetSdkVersion 24
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(include: ['*.jar'], dir: 'libs')
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
compile 'com.android.support:appcompat-v4:25.3.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:10.2.6'
}
apply plugin: 'com.google.gms.google-services'
several way to try
Invalidate Cache/Restart AS
Clean Project and Rebuild
Update "Google Repository" and "Android Support repository" in the Android SDK Manager.
if not working, then If you are trying to get the support repository, this is the correct import:
compile "com.android.support:support-v4:25.3.1"
If your compile api isn't 25, change the version to the latest with your compile api.
Android Studio should give you a yellow warning if you are using incompatible version. just hover it and use the suggestion given
P/s: Please please dont use com.google.android.gms:play-services.. it very heavy dex method count
I've tried to add firebase to my project, but I got stuck. Here is my build gradle project:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here is my build gradle module app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.vlad.comentariibac"
minSdkVersion 9
targetSdkVersion 24
versionCode 5
versionName "1.4"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.firebase:firebase-core:10.0.1'
}
apply plugin: 'com.google.gms.google-services'
The line
compile 'com.google.android.gms:play-services-ads:9.0.0'
is highlighted with red and is saying that all google.android.gms libraries must use the exact same version specification. I need some help. Thanks in advance!
On Android, Firebase is actually part of Play services. When you build with Firebase, all of the SDK versions must match your Play services SDK versions. As it stands now, you are asking for 9.0.0 of play-services-ads and 10.0.1 of firebase-core. These need to match, and the latest version of the entire set of Play services SDKs is 10.0.1.
I was trying to create a demo project based on Google Map, for this I was using MapsActivity provided by android studio. Everything is fine excluding the Google Play services. Android studio is failed to resolve play-services and throwing an error-
Error:(27, 13) Failed to resolve: com.google.android.gms:play-services:9.4.0
Install Repository and sync project
Show in File
Show in Project Structure dialog
Project Gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.mymapapplication"
minSdkVersion 15
targetSdkVersion 24
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:24.2.1'
compile 'com.google.android.gms:play-services:9.4.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
I have the updated sdk tools Google Play services v-33 and Google Repository v-36.
I tried many things to handle it, but still facing the same problem.
Resolved the issue, it was a bug on the repository link.
"Install Google Repository" failed.
Failed packages:
- Google Repository (extras;google;m2repository)
Now the new link- https://dl.google.com/android/repository/google_m2repository_gms_v7_rc28_wear_2a3.zip(at this time) working fine, I updated my google repository and google play-services and its work like a charm.
I am setting up an Android server project for pushing notification using this documentation from Firebase website. At first, I have set up the project at Firebase console and added the JSON file & Google services plugin.
But while syncing the project after adding
compile 'com.google.firebase:firebase-server-sdk:3.0.1', there is the error:
Version: 3.0.1 is lower than the minimum version (9.0.0) required for google-services plugin.
My app build.gradle is-
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "ton.com.serverandroid"
minSdkVersion 15
targetSdkVersion 24
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:24.2.1'
compile 'com.google.firebase:firebase-server-sdk:3.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
My project build.gradle is
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried to use google-services version 2.1.0 but it wasn't working either with the error:
Conflict with dependency 'com.google.code.findbugs:jsr305'. Resolved versions for app (1.3.9) and test app (2.0.1) differ.
But I can't go farther in that case.
I answer a similar question today, you can see the correct dependences here enter link description here, this ones are most important to import other dependencies in android client. Then for server sdk you need to add this one in app.gradle:
compile 'com.google.firebase:firebase-server-sdk:[3.0.0,)'
For use FirebaseCloudMessaging you need other one in app.gradle:
compile 'com.google.firebase:firebase-messaging:9.0.0'
Tell us if you wan compile now, greetings!