Android Studio Google Maps dependencies - android

Android Studio and Google Maps dependencies have finally defeated me. I did have it working but had to change some things to get my app to use the correct API Key.
Now I click on run and it say's build successful, but it doesn't actually run the project on the simulator and it puts a whole load of red circles with white exclamation marks in the messages window. Nothing happens if you click on those circles and there's no explanation as to what they mean.
I've a feeling it's saying there are dependencies of the dependencies I've included but I've moved away from individual Play service includes and included the whole lot, with the whole support library and still nothing happens.
Can anyone tell me what's going on, or how I can fix this, or even where I look next to find out why this won't run.
These are my dependencies in my build.gradle.
dependencies {
compile files('libs/jackson-annotations-2.9.0.jar')
compile files('libs/jackson-databind-2.9.0.jar')
compile files('libs/jackson-core-2.9.0.jar')
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.android.support:appcompat-v7:25.2.0'
}
apply plugin: 'com.google.gms.google-services'
This is the error
This is where it says the build was successful
Thanks

Change compile 'com.google.android.gms:play-services:11.0.4' to compile 'com.google.android.gms:play-services-maps:11.8.0' // you dont need use all play-services
And try again!

I think that you have a dependency conflict, i suggest in this case to use the version 11.0.2:
compile 'com.google.android.gms:play-services:11.0.2'
btw, loading all the Play Services Library is not necessary to use Google Maps,
use only this dependency:
compile 'com.google.android.gms:play-services-maps:11.0.2'

Related

Failed to resolve: com.onesignal:OneSignal:3.4.3

I'm trying to setup OneSignal push notifocation in my Android app. I have changed my build.gradle to include the required dependencies (or so I think).
No matter what I do I keep getting
Failed to resolve: com.onesignal:OneSignal:3.4.3
or
Could not find com.onesignal:OneSignal:3.4.3
Can anyone give me a slight push please? Thanks in advance :-)
I should mention that I have checked the trouble shooting section on OneSignals home page. All is in order.
Here's the dependencies section of my gradle file:
dependencies {
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.google.firebase:firebase-analytics:9.6.0'
compile 'com.google.firebase:firebase-crash:9.6.0'
compile files('src/main/libs/simple-xml-2.7.jar')
compile files('src/main/libs/date4j.jar')
compile files('src/main/libs/picasso-2.5.2.jar')
compile 'com.onesignal:OneSignal:3.4.3#aar'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
}
The OneSignal SDK is hosted on Maven Central so I would first make sure you can access this from your system. Next double check the following as well.
Make sure you're using Android Studio version 1.4.0 or newer.
Go to File>Settings. Search for Offline work and uncheck that option.
Add the following to your .gradle file.
Root build.gradle
repositories {
mavenCentral()
}
4. Try restarting Android Studio and then going to Tool>Android>Sync Project again.
5.Try building OneSignal's example Android Studio project. If this works then the problems is related to your project.
Screenshots for some of these steps below.
https://documentation.onesignal.com/docs/troubleshooting-android
Well... what finally fixed this issue for me was to replace
mavenCentral()
with
jcenter()
go figure... :-)

Version conflict error is being shown, apparently there is no version conflict

I am facing this error after upgrading my google servces plugin. Apparently there is no version conflict as you can see its 9.2.0, the compiler is giving a completely different error of google services-plugin.
I have searched for it on many places and I have found people are getting this error because they haven't written this at the end:
apply plugin: 'com.google.gms.google-services'
but I have written it and still getting this error.
Here is what the error looks like:
The problem is with com.google.android.gms:play-services-auth:10.0.1 which is newer version as compared to other dependencies with version 9.2.0. You can simply use latest version of each of them and resolve conflicts.
So either go for 9.2.0
compile 'com.google.android.gms:play-services-auth:9.2.0'
compile 'com.google.firebase:firebase-auth:9.2.0'
or for 10.0.1
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
And obviously I would suggest to go for latest version always.
Use the same version for every thing.
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.google.firebase:firebase-aurh:10.0.1'

AdMob without Firebase, not resolving

We were using AdMob with out Firebase, we don't need Firebase integration and we are just trying to ad below in dependencies:
dependencies {
compile 'com.google.firebase:firebase-ads:9.4.0'
}
It's not resolving the AdMob variables, we are stuck here. We tried all clean, make project steps. Someone faced this issue?
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:xx.x.x'
compile 'com.google.firebase:firebase-ads:9.6.0'
}
...
apply plugin: 'com.google.gms.google-services'
Have you tried apply plugin: 'com.google.gms.google-services'after dependencies.
If not., add and sync once. Hope this will help.
for more details. read this document.
https://firebase.google.com/docs/admob/android/quick-start
If you're not using Firebase, it's best to avoid using any of the Firebase gradle dependencies. Instead, use this one to import the Google Mobile Ads SDK by itself:
dependencies {
compile 'com.google.android.gms:play-services-ads:9.6.0'
}
You'll need to make sure the Google Repository has been downloaded by your SDK manager. If it's not, don't worry -- Android Studio will prompt you.
If you're interested, we wrote a blog post about the different ways of importing the SDK, and what your app will get with each one.
Hope that helps!

How to resolve Theme.AppCompat.Light error

I am facing a issue after run existing android studio project. Please check error below and let me know how to resolve that.
Error:(54) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
Thanks in advance
Try to use accroding gradle plugin. I've got the problem with plugin 2.3-beta1 and Studio 2.2.3, when changed to plugin 2.2.3 - everything worked like a charm
Please change compileSdkVersion and buildToolsVersion in your gradle file according to your android studio existing running project.
Our compile SDK version must match the support library's major
version.
If you are using version 23 of the support library, you need to compile against version 23 of the Android SDK.
Alternatively you can continue compiling against version 22 of the Android SDK by switching to the latest support library v22.
You can either change it manually in your build.gradle, or you can use
the GUI by opening up the project properties and going to the
"dependencies" tab.
Or Press Ctrl + Shift + Alt + S to get to the project structure page. Go to the properties tab and change version to 23.0.0 or whatever latest in the build tool area and rebuild your project.
If that doesn't work, go to gradle:app and then
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
Edit version as shown above and sync gradle.
Ran into same issue as OP, March 2017 Android Studio 2.3.
My build was working fine for months, and this issue came up right after adding a new line to gradle build file. Ultimately making some changes in Gradle and re-sync'ing fixed the issue, but my Gradle ended up being exactly the same as when the issue first came up, strangely.
My original Gradle build dependencies:
compile 'com.android.support:design:25.1.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v4:25.1.1'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:gridlayout-v7:25.1.1'
compile 'com.android.support:cardview-v7:25.1.1'
compile 'com.android.support:recyclerview-v7:25.1.1'
compile 'com.google.android.gms:play-services-location:10.0.0'
compile 'com.google.android.gms:play-services-maps:10.0.0'
compile 'com.google.maps.android:android-maps-utils:0.5'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.code.gson:gson:2.4'
Then, I simply added a new line:
compile 'org.scribe:scribe:1.3.5'
This is when the issue appeared, same as OP.
I saw red errors in my styles.xml and wondered "wtf?".
Cleaning and re-building had no affect.
Going back to the Gradle build file, I commented-out that new line. ISSUE RESOLVED! So obviously there was something going on.
For fun, I put that line, uncommented, at the top of this compile list. NO ISSUE!
For fun yet again, I put that line back again to the bottom of the list (like how originally added it). NO ISSUE.... weird!
How Gradle sync'ing responds doesn't seem to be 100% consistent. I did no other changes to my project. All I can say is try toggling and re-ordering things in the compile list.

Android studio build gradle sync failed

I am trying to add google play service to my project but it gives me error when I try to edit build (Gradle).
How can I fix it?
In your configuration there some issues.
You are using the wrong build.gradle file.
It is your top-level file.
You should add this line in your app/build.gradle
There is a typo. You are missing the ' at the end of the line compile.
Use an updated version.
For example use:
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.google.android.gms:play-services:8.1.0'
}
Finally refer this official doc for more info.
In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit.
For example if you need to make only your app aware of location updates add
compile 'com.google.android.gms:play-services-location:8.1.0' only in gradle or if you need only map choose compile 'com.google.android.gms:play-services-maps:8.1.0'.
Please replace
compile 'com.google.android.gms:play-services:3.1.36
with
compile 'com.google.android.gms:play-services:3.1.36'
One thing you can try is Right Click on app open module settings on Dependencies Tab click '+' icon and add there 'com.google.android.gms:play-services:8.1.0' and click search icon and add that dependency,
So i don't want to elaborate what you had done wrong as my colleagues figured it out.I like to say, while playing with Google Play Service
Selectively compile APIs into your executable
In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit.
For example if you need to make only your app aware of location
updates add compile
'com.google.android.gms:play-services-location:8.1.0' only in gradle
or if you need only map choose compile
'com.google.android.gms:play-services-maps:8.1.0'.
Thank you.
Visit for more.

Categories

Resources