Android Studio gradle update error - android

I am working on geofencing app in Android. If I set the
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-location:9.0.1'
}
it works fine.If I changed it to
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-location:11.0.2'
}
I get following error.
package com.google.android.gms.maps does not exist
package com.google.android.gms.maps.model does not exist
Why? I need to set it to 11.0.2 for integrating it with other app.

Sync Project With Gradle File may help. Just click the button next to AVD Manager or navigate through Tools->Android->Sync Project With Gradle File.

Try to sync your project with gradle file but if gradle sync failed then download the latest version of gradle and specify its path under build.gradle and try to sync again.

you got to install the missing google play services.
Go to settings and update your google play services and google repository to latest version which is 46 means you got to use this version 11.0.46

Related

admob to deprecate sdk to replace with Ads SDK 7.0.0 - how to upgrade just admob jar in google play services

Let me show you my current build dependencies so you understand my frustation:
dependencies {
compile 'com.google.android.gms:play-services-ads:8.3.+'
compile 'com.google.android.gms:play-services-wearable:8.3.+'
compile 'com.google.android.gms:play-services-plus:8.3.+'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.onesignal:OneSignal:2.+#aar'
compile 'com.google.android.gms:play-services-analytics:8.3.+'
compile "com.google.android.gms:play-services-location:8.3.+"
compile 'com.google.android.gms:play-services-gcm:8.3.+'
compile 'com.android.support:design:22.2.+'
//for now disable wearApp dependency for PaidRelease builds
wearApp project(':wearable')
compile 'com.squareup:otto:1.3.5'
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:support-v4:22.0.+'
compile 'com.android.support:appcompat-v7:23.0.+'
}
and here are my wearable dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:1.2.0'
compile 'com.google.android.gms:play-services-wearable:7.5.0'
}
Notice in my apps dependencies i am using 8.3.+ for the version meaning only update minor version changes. Admob wrote me the following a few days ago:
In order to ensure that your ads continue to serve after September 15th, 2016, please upgrade to Google Mobile Ads SDK 7.0.0 or higher.
They said one way to do this is to just update the entire google play services to 9.0.2. But I am not using entire Play Service dependencies. As you can see I just get the exact packages I need to save space and method count.
The issue:
If I were to replace the following line:
compile 'com.google.android.gms:play-services-ads:8.3.+'
with
compile 'com.google.android.gms:play-services-ads:9.0.2'
I am not confident it will work with the 8.3.+ jars I depend on. Wont I have to update the entire google play services jars I am using to be 9.0.+ also?
You're already using version 8.3 as denoted by play-services-ads:8.3.+, well above the 7.0.0 cutoff, so there's no action needed on your part.

Android Studio cannot resolve support library name space

I installed Android Studio over existing SDK with the latest Android Support Library but with a blank project open it cannot resolve this: import android.support.v7.app.AppCompatActivity;
What should I do?
Check your gradle file. It must include (version may way):
compile 'com.android.support:appcompat-v7:23.3.0'
In your gradle.build include this dependency
compile 'com.android.support:appcompat-v7:23.3.0'
Check your build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
**compile 'com.android.support:appcompat-v7:23.2.0'**
}
This may solve your problem.

why gradle attemps to download appcompat again

Why gradle trys to download dependencies again, when it downloaded them in past?
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.androied.support:appcompat-v7:23.0.1'
//compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:cardview-v7:23.0.1'
compile project(':sweetsheet')
compile files('libs/bolts-tasks-1.3.0.jar')
}
the error:
Error:(30, 13) Failed to resolve: com.androied.support:appcompat-v7:23.0.1
Show in File<br>Show in Project Structure dialog
I'm not online all the time. I downloaded the appcompat-v7:
screenshot of downloaded appcompat-v7
You have a typo.
com.androi e d.support:appcompat-v7:23.0.1 instead of
com.android.support:appcompat-v7:23.0.1
You can change gradle settings in the android studio
Go to settings and type gradle then you can tick gradle offline work and the gradle is not going download dependencies every time.

NoClassDefFoundError: com.firebase.ui.auth.google.GoogleAuthProvider

I'm using Android Studio 1.5 and trying to add Firebase UI library to my application.
I've added it to my dependencies.
For some reason I'm getting the NoClassDefFoundError exception.
I've read that I should add Firebase-UI jar to my 'libs' folder, but I can't find it.
Any suggestions?
Most likely your missing the Google Play Services dependency from your app's build.gradle. For reference, this is one of mine:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.firebaseui:firebase-ui:0.3.0'
compile 'com.google.android.gms:play-services-auth:8.3.0'
}
FirebaseUI depends on com.google.android.gms:play-services-auth:8.3.0 for its Google authentication. For all dependencies, see this section of the README.

Failed to resolve play service v 7.0.0 onwards

I am trying to sync Gradle with the following dependencies
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:7.0.0' }
but its giving following error
after clicking on the link provided in the screenshot it opens and say the following
I'm not able to solve this problem.
My Android Repo and all support library is updated.
TIA

Categories

Resources