GooglePlay services integration with froyo fails in gradle - android

I am on Android Studio and I have followed the instructions on Google here.
I have downloaded via the SDK Manager the google repository, google play services for froyo and not for froyo.
My gradle
// this works
// compile 'com.google.android.gms:play-services:4.1.32'
// this doesn't
// compile 'com.google.android.gms:play-services:3.2.65'
(I uncomment one or the other, not both at the same time)
My manifest
<application
...
android:theme="#style/AppTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"/>
Any idea ?

iirc, Google doesn't actually provide an aar for froyo play services. I think you have to manually import ANDROID_SDK\extras\google\google_play_services_froyo\libproject\google-play-ser‌​vices_lib from your SDK directory as a module, then compile that module as a dependency in gradle.
The link you referenced that you were following mentions nothing about froyo or gradle, are you sure you're following the right tutorial? This seems to indicate my answer above if correct: http://developer.android.com/google/play-services/setup.html

The workaround is from Nov 2013 to hardcode the gms version in the manifest
https://code.google.com/p/android/issues/detail?id=61675

"com.google.android.gms.ads.AdActivity" does not exist in version 3.2.65 (Froyo) of Google Play Services. Google seems to have stopped updating the library for google_play_services_froyo.
a
you will need to use google_play_services (current version is 4.3.23) to use AdView and AdRequest, but that version requires a minsdk of 9 (Gingerbread).
I am facing the same problem as you, and I have a small percentage of active users still using Froyo (mostly in third world countries). For now I intend to split my apps to different flavors- one of which will use the Admob standalone SDK until they stop serving ads (and it'll remain ad free for my Froyo users).

Related

Google play services after importing to AS from Eclipse

I just imported a project from Eclipse to AS. In the project I'm using Google Maps, and in Eclipse I had these lines in the manifest:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY">
Importing the project left these lines. Do I still need them in the manifest now when using Gradle or can I just add this line to gradle.build and thats it?
compile 'com.google.android.gms:play-services:9.4.0'
Short answer- you need both!
Explanation (if you require it)
The Gradle lines basically tell Gradle to pull in the library called 'com.google.android.gms:play-services' and the version '9.4.0'. This is just a bunch of code you'll want to include in your project. (It's a lot of code, when your project looks bigger you'll want to split that out into just the components you use)
Meta data is used for different things than Gradle dependencies are- specifically in your case, you are using it here to:
supply your google api key, and,
supply your google play services version number
NOTE: hide your API key!!!! (just google "why should I hide my api key")
The version number is the version that your app expects to use, which you might specify if you are working on an older version, or for a workaround. Typically, these fields are just used to show maps.
The API key is used to access your Web Console app client for your app- i.e., the app on Google API Console that you linked to your Android Studio app. This is not something you want publically exposed on Stack Overflow.
Hope that helps :)

Can I remove com.google.android.gms.version from AndroidManifest when I use gradle?

I wonder if I can remove this line safely:
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
from my AndroidManifest.xml when I use gradle to build my APK.
According to the website https://developers.google.com/android/guides/setup only when I choose "ECLIPSE WITH ADT" I have to add this line. For "ANDROID STUDIO" usage this is not mentioned.
But in my case I use Eclipse (with ADT) as IDE but I build with gradle. (Actually it is a libGDX project). So I added the play-services by using gradle:
compile "com.google.android.gms:play-services:8.1.0"
So I run the app on a test device and I tested to login with play-services and it worked fine without having the line above in my AndroidManifest.xml
But, maybe the login just does not need the "com.google.android.gms.version" value and another part of the play services lib needs it? But I cannot test all the possible ways to use the lib.
Does anybody know for sure?
Or for those of you who use Android Studio + play services: Does your AndroidManifest.xml have the line above?
Yes, as of Google Play services 7.0 (improved in 7.5 to remove the restriction on applying to the full play-services dependency), the <meta-data> tag is automatically added to your Manifest file by Gradle via Manifest merging.

Can't get the google_play_services_version value after setting the google services API

I've set the Google play services API on my android app project, I did as I saw in the documentation for google android developer. I started by copying the google library services in the folder of my project, then I added the refernce in the build (like we see in the photo the gooogle play services lib is perfectly deployed) and then I tried to copy this piece of code in android but manifiest not recognize the second line. android:value="#integer/google_play_services_version"
So any help for that please ! Thanks
Xavier is right, there are no resources in the GooglePlayServices JAR file you usually get your compiled classes.
As you're in Android Studio you can just add to your gradle dependencies : compile 'com.google.android.gms:play-services:5.2.08'

Google Play Services library loaded, referenced but still won't work, not even in sample projects?

I am trying to use the Google Play Services library for the Cloud Messaging functionality, but without any luck.
I have updated Eclipse to the latest version, and downloaded the Google Play Services lib via SDK Manager.
Imported the library into the Eclipse workspace
Referenced the library in the sample App's proprietaries
But as u can see in the images, "The import com.google.android.gms.common cannot be resolved" message appears, and none of the library commands works.
What could be wrong?
Thanks
Hi-Rez screenshot:
http://edmondvarga.com/demo/screenshot.jpg
Does your lib project look like this:
Add the Google Play services version to your app's manifest
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />

Google Admob Integration Errors

I am working on an app for Android 2.2 Platform, wanted to integrate admob into it, StackOverflow I set up an account downloaded the latest admob SDK and created an ad Layout in XML followed the instructions mentioned in docs. I have set the target in project properties to 1.4 and set the min SDK to 8. Now the error occurs when I configure
<activity Android:name="com.Google.ads.AdActivity" Android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
The String
keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize
wont compile for Android 2.2 it throws errors. However if I compile without these screenSize|smallestScreenSize, it compiles but the ad area in the app shows an error saying You must have AdActivity declared in AndroidManifest with configChanges
Can you guys suggest a solution, any help with this problem is appreciated.
The Google AdMob SDK v4.3.1 requires the additional config changes for optimization on tablets that are running apps with Google AdMob Ads. The configChanges screenSize and smallestScreenSize were not introduced until android-13, so therefore the Google AdMob SDK requires you to COMPILE against Android 3.2 or greater.
You can still make your app run on Android 2.2 devices/emulators by setting the minSdkVersion in your manifest:
<uses-sdk android:minSdkVersion="8" />
set target in project.properties to android-13 (Android v3.2)
not in manifest! (this is that I misunderstood)

Categories

Resources