Installing Google Play Services [duplicate] - android

This question already has answers here:
Failed to resolve com.google.android.gms play-services-auth:11.4.0
(13 answers)
Failed to resolve: com.android.support:cardview-v7:26.0.0 android
(26 answers)
Failed to resolve: com.android.support:appcompat-v7:26.0.0
(14 answers)
Closed 5 years ago.
I want to use location APIs with Google Play Services
This is top-level gradle file :
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
}
and this is my app-level gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "..."
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
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-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.google.android.gms:play-services:11.4.2'
}
When I want to build the project, this error shown :
Error:(30, 13) Failed to resolve: com.google.android.gms:play-services:11.4.2
Install Repository and sync project
Show in File
Show in Project Structure dialog
I have Installed Google Play Services By Clicking on "Install Repository and Sync Project" but the error still shown
According to this documentation :
https://developers.google.com/android/guides/setup
I have replaced google-play-services dependency with this lines :
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.android.gms:play-services-maps:11.4.2'
When I build project, "Failed to resolve ... " error shown but when I click on "Install Repository and sync project" nothing happened !
What is the problem ? There is problem on version numbers ? or something else ?!

From what is written HERE, to use google play services from version 11.2.0 your project compileSdkVersion must be set to, at least, version 26.
When you upgrade your app’s Play services dependencies to 11.2.0 or later, your app’s build.gradle must also be updated to specify a compileSdkVersion of at least 26 (Android O). This does not change the way your app runs. You will not be required to update targetSdkVersion.
Since your project is running on version 25, the max google play service version you can import in gradle is version 11.0.
compile 'com.google.android.gms:play-services-location:11.0'

You need to add the following to your project level Gradle file:
allprojects {
repositories {
maven { url "https:// maven.google.com" }
}
}
//This is when you are using a version of Gradle below 4.1.
Note - if you are following this, then you also need to downgrade your play services dependency version. A better way would be to update to latest compileSDKVersion

Related

Error: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:27.1.1 [duplicate]

I have searched around a lot but I cannot really find a post that helps I am somewhat new to android so some of this goes over my head. Anyway, my problems started when I got an error saying gradle plugin was old and the sync would not complete. So I changed a few things around not really sure what I did. Now I have:
Error(25,13) Failed to resolve: com.android.support:appcompat-v7 24.0.1
Project gradle file:
// 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'
// 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 file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.bisesifreelance.maxbisesi.tic_tac_toe"
minSdkVersion 23
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.0.1'
testCompile 'junit:junit:4.12'
}
Also I have installed all build tools in SDK manager I'm not allowed to embed images yet? but it says:
Android SDK Plaform-Tools 24.03 installed
Android SDK Tools 25.2.2 installed
Thank YOu! I'm very lost.
You can also write like this:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
try
compile 'com.android.support:appcompat-v7:24.2.1'
EDIT
For sdk 27
buildToolsVersion "27.0.3"
implementation "com.android.support:appcompat-v7:27.1.1"
Try adding jcenter like this way
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
Rather than
repositories {
jcenter()
}
Make sure that this folder exists:
\your-android-sdk\extras\android\m2repository\com\android\support\appcompat-v7\24.0.1
Of course, 24.0.1 should be replaced by the latest version.
I had this problem because I occasionally renamed 24.0.1 to something else and so the required folder couldn't be found.
I had the same problem after updating Android Studio. In my case it was an issue of permissions as I do my day-to-day programming on my user account, while Android studio was installed and updated with the administrator account.
FIX:
Open the standalone SDK manager and go down to 'extras'. Click on 'Android Support Repository' (which will probably set as 'Not installed') and install the packages. If you are prompted with an error message saying something like 'error trying to rename folder'. Go to the folder that is mentioned in the message and make sure that the permissions are set correctly. After that click 'Try Again' and it should install the package without a problem.
NOTE: This might happen a few more times. Just repeat the process for each file. The problem should then be solved.
Change a character - to :
compile 'com.android.support:appcompat-v7:24.2.1'
rather than
compile 'com.android.support:appcompat-v7-24.2.1'
try update the IDE and remove earlier build version (like 23) after installing later one and rename it to newer one.
Open SDK Manager and update the Extras-->Android Support Repository.
Path ..sdk\extras\android\m2repository\com\android\support\appcompat-v7>
Check for the updated version being installed.
In build.gradle in all projects, add Marvel and add this URL 'https://maven.google.com'

Android Studio Gradle Sync Error using google play-services-maps 11.6.2

I am developing a google map app using Android Studio. When I sync the project with Gradle Files (Select Tools/Android/Sync Project with Gradle Files on Android Studio), I get the following error:
Could not resolve com.google.android.gms:play-services-maps:11.6.2.
Couold not get resource 'https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-maps/11.62./play-services-maps-11.6.2.pom
This is the software I am using:
Android Studio 3.0.1
Android Version 7.1.1
Google Play Services 46
Google Repository 58 (under Support Repository)
I've tried using both the google maps project template and the empty activity project but I get the same error.
I am using the http proxy setup I used from earlier projects. I am able to install the play-services-maps and the google repository.
I also added the maven url to the Gradle Project file in the All Projects/Repositories section.
I have tried the suggestions from Stack Overflow but none have not worked.
Any ideas?
Gradle Project Build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The gradle app build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "hansen.scott.googlemaps"
minSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-maps:11.6.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
The error is in the line:
implementation 'com.google.android.gms:play-services-maps:11.6.2'
try adding this in project level gradle file
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
}
}
Someone had the same issue I did and entered it on Stack Overflow a day or two ago. The user was getting a build error when using player-services-maps 11.6.2. If the user changed the version to 11.0.0, the build succeeded.
Once I back-dated the maps version to 11.0.0, this solved my problem too. I created a new Google Map project and didn't modify the Gradle Build files.
The problem appears to be that play-services-maps won't build using a versions after 11.0.0. I will post the issue on Github.
Thank you for everybody's help.
I have been facing the same issue for the past one week and posted it on Stack Overflow as well but to no effect.
I have since then figured out the root cause. I am working out of my office and thus have firewalls in place. I got it checked with the system admin and on turning off the firewall the build worked.
So i would advice you to have this checked as well.
Kind regards,
Kabir

Updated Android Studio - Firebase Auth Fails

Everything worked before I updated Android Studio, Android Support Repository, Google Play Services, and Google Repository today. Now I can't get past my login screen. As I mentioned in the title, I'm using Firebase for authentication and data storage.
I'm also using an emulator: Nexus 6p API 23
Here's the error that I get when I try to sign in
03-05 13:39:50.689 2790-2852/alodia.medremind W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
03-05 13:39:50.698 2790-2852/alodia.medremind W/GooglePlayServicesUtil: Google Play services out of date. Requires 10298000 but found 10084470
Here's my project build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here's my app build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "alodia.medremind"
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.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.firebase:firebase-core:10.2.0'
compile "com.google.firebase:firebase-auth:10.2.0"
compile "com.google.firebase:firebase-database:10.2.0"
compile "com.google.firebase:firebase-storage:10.2.0"
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'org.parceler:parceler-api:1.1.1'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
testCompile 'junit:junit:4.12'
apt 'org.parceler:parceler:1.1.1'
}
apply plugin: 'com.google.gms.google-services'
It'd be great to be able to fix this issue, but I mostly want to know the why behind this problem. I'm fairly new to Android and I'm sure that I misunderstand a lot of basic concepts.
clean your project and rebuild, if not worked then you can refer to this post.
Your google play service must be in version 10.2.0 or higher :
'com.google.gms:google-services:10.2.0'
Your emulator system image does not have the latest revision (10.2.98) of Google Play Services.
From Android Studio, open the SDK Manager and check the Show Package Details box. Because you are testing with an API 23 image, scroll down to the section for Android 6.0. Update the emulator images with names of the form Google APIs ... System Image. The latest is Rev 20.
When you run the emulator, you can confirm you have the latest version by going to Settings > Apps, scrolling to Google Play Services, and clicking to see the version number in the App Info.
I solved this problem by updating Google Play Services in the phone from 8.0 to 11.0.
i just solved my problem bro, i think you just need re-sync the firebase, follow this step click tab Tools -> firebase -> choose 1 of the firebase feature -> if the button connected is in the gray color, you have to re-sync the firebase, it will update the firebase configuration to the latest version. hope it will help.
make sure that you have added firebase authentication to your project after you connected the project to firebase.

failed to resolve com.google.firebase:firebase-core:10.0.1

I want to use Firebase Cloud Messaging in my Android App.
This is my app level gradle file
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'androiddebugkey'
keyPassword 'android'
}
config1 {
keyPassword 'android'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.3"
packagingOptions {
exclude 'main/AndroidManifest.xml'
}
defaultConfig {
applicationId "com.shikhar.dexter.project"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
This is my root level gradle file
// 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'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application depndencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven{
url "http://dl.bintray.com/dasar/maven"
}
}
}
While compiling it shows these Errors:
Failed to resolve: com.google.firebase:firebase-core:10.0.1
Error:(36, 13) Failed to resolve: com.google.firebase:firebase-messaging:10.0.1
I tried with various Google Play Services Versions like 9.4.0 but still it doesn't work.
Open SDK Manager and make sure you have latest "Google Play Services" dependency downloaded.
In addition to downloading the latest "Google Play Services" as suggested by John Oreilly above I also had to update my 'Google Repository' to get it to work.
In Android Studio go to "Tools -> Android -> SDK manager". In the SDK manager select the tab "SDK Tools" and below "Support Repository" you find 'Google Repository', upgrade it if it's not using the latest version.
Probably needs an update of Google Play Services and Google Repository.
In Android Studio SDK Manager:
Select SDK Tools tab
Select and install Google Play Services
and Google Repository
Sync and Build
see screenshot
Try adding all the google dependencies of same version and keep the "Google Play Services" updated in the SDK Manager.
compile 'com.google.firebase:firebase-appindexing:10.0.0'
compile 'com.google.android.gms:play-services-auth:10.0.0'
compile 'com.google.android.gms:play-services-places:10.0.0'
just had the problem, that with the update from Support Repository v44 to v45 (mid of March 2107); the repository location suddenly changed and therefore some dependencies broke, resulting in quite the same error message (the reason why I want to add this as a possible answer).
in the Project level build.gradle, the repository v44 was located at:
repositories {
maven { url '... /sdk/extras/android/m2repository' }
}
while in the meanwhile, the repository v45 is located at:
repositories {
maven { url '... /sdk/extras/m2repository' }
}
in order to refresh and to get debug information:
./gradlew clean --debug
even with other versions of the repository, it may help to browse the directory structure and compare the location of the repository with the location referenced in the build.gradle, which is supposed to host these dependencies.
I Solved this problem in my computer(I use Intelij)
what I did is:
1)Go to tools-> SDK manager and update the google play serve and the google repstories.
2)add to the build this maven { url "https://maven.google.com" }under allprojects->repstories

Failed to resolve: com.android.support:appcompat-v7 24.0.1

I have searched around a lot but I cannot really find a post that helps I am somewhat new to android so some of this goes over my head. Anyway, my problems started when I got an error saying gradle plugin was old and the sync would not complete. So I changed a few things around not really sure what I did. Now I have:
Error(25,13) Failed to resolve: com.android.support:appcompat-v7 24.0.1
Project gradle file:
// 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'
// 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 file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.bisesifreelance.maxbisesi.tic_tac_toe"
minSdkVersion 23
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.0.1'
testCompile 'junit:junit:4.12'
}
Also I have installed all build tools in SDK manager I'm not allowed to embed images yet? but it says:
Android SDK Plaform-Tools 24.03 installed
Android SDK Tools 25.2.2 installed
Thank YOu! I'm very lost.
You can also write like this:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
try
compile 'com.android.support:appcompat-v7:24.2.1'
EDIT
For sdk 27
buildToolsVersion "27.0.3"
implementation "com.android.support:appcompat-v7:27.1.1"
Try adding jcenter like this way
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
Rather than
repositories {
jcenter()
}
Make sure that this folder exists:
\your-android-sdk\extras\android\m2repository\com\android\support\appcompat-v7\24.0.1
Of course, 24.0.1 should be replaced by the latest version.
I had this problem because I occasionally renamed 24.0.1 to something else and so the required folder couldn't be found.
I had the same problem after updating Android Studio. In my case it was an issue of permissions as I do my day-to-day programming on my user account, while Android studio was installed and updated with the administrator account.
FIX:
Open the standalone SDK manager and go down to 'extras'. Click on 'Android Support Repository' (which will probably set as 'Not installed') and install the packages. If you are prompted with an error message saying something like 'error trying to rename folder'. Go to the folder that is mentioned in the message and make sure that the permissions are set correctly. After that click 'Try Again' and it should install the package without a problem.
NOTE: This might happen a few more times. Just repeat the process for each file. The problem should then be solved.
Change a character - to :
compile 'com.android.support:appcompat-v7:24.2.1'
rather than
compile 'com.android.support:appcompat-v7-24.2.1'
try update the IDE and remove earlier build version (like 23) after installing later one and rename it to newer one.
Open SDK Manager and update the Extras-->Android Support Repository.
Path ..sdk\extras\android\m2repository\com\android\support\appcompat-v7>
Check for the updated version being installed.
In build.gradle in all projects, add Marvel and add this URL 'https://maven.google.com'

Categories

Resources