Google Play services out of date. Requires 11011000 but found 10289574 - android

I've been strugling with this problem about week now. Been searching similar topics about this but still can't resolve my problem.
The Prolem is that when i'm trying to run my program on Polar m600 wear or wear emulator (Android V 7.1.1 and API25) they'r giving me this message "Google Play services out of date. Requires 11011000 but found 10289574".
I've followed the "Getting the Last Known Location" part in the android developer site. (Link for the site https://developer.android.com/training/location/retrieve-current.html#play-services)
Here's my Mainactivity code which i'm using
public class MainActivity extends Activity {
private FusedLocationProviderClient mFusedLocationClient;
public Location mLastLocation;
private TextView mTextView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
#Override
public void onLayoutInflated(WatchViewStub stub) {
mTextView = (TextView) stub.findViewById(R.id.text);
}
});
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
return;
}
mFusedLocationClient.getLastLocation()
.addOnSuccessListener(this, new OnSuccessListener<Location>() {
#Override
public void onSuccess(Location location) {
mLastLocation = location;
Log.d("Location is:",""+mLastLocation);
if (location != null) {
}
}
});
}
}
Here's my manifest.xml`
<uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#android:style/Theme.DeviceDefault">
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
And last but not least my build.gradle
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "ims.fhj.at.testnavigators"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:2.0.3'
compile 'com.google.android.gms:play-services-wearable:11.0.1'
compile 'com.google.android.gms:play-services:11.0.1'}

Create emulator Nexus 5x with Android version O - api 26 - x86 or Android version Nougat - api 24 - x86
Then click on the 3 dots in the emulator and this will open the extanded window, there click on Google Play + update. And that will update Google Play Services to the latest update thats 11.0.55 today.

You have to downgrade the API in wearable gradle file.
The problem is that your device doesn't have up-to-date Google Play Services application.
To fix it change into this:
compile 'com.google.android.gms:play-services-wearable:10.0.0'
compile 'com.google.android.gms:play-services:10.0.0'

My solution is super weird:
Goto Settings -> Apps -> System Apps -> Google Play Store
My version was 10xxxxx which is weird because my watch updated on boot. So, I clicked Remove Update and the version changed to 11xxxxxx.

The problem here is the mismatch of google play services (version) on emulator and gradle file.
It can be solved by two ways:
Remove the mismatch by downgrading the version of google play services
(version) in gradle file to the Google Play Services (version) of the emulator.
Upgrade the Google Play Services on the emulator.

As String wrote the Play Services are not updated on the device.
Unfortunately In a WearOS world it might be that the Play Services are up-to date, but
they are simply not available on the wearables. In that case you can use following methods to react:
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int result = apiAvailability.isGooglePlayServicesAvailable(this);
if (result != ConnectionResult.SUCCESS) {
...
} else {
apiAvailability.getErrorDialog(this, result, REQUEST_CODE,this).show();
}

This has been an ongoing issue with Wear for years (see for example Android Wear Google Play Services).
The best solution seems to be to not use the latest Play Services release. One option is to find a minimum version that seems to cover your targeted production devices; in your case, this sounds like something in the 10.2 range. Alternatively, pick the lowest release that includes all the functionality you need (I personally am using 9.8.0).
For reference, here is the Play Services release history: https://developers.google.com/android/guides/releases

Sometimes this error my occur when you pass the wrong web-client-id value
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(**web-client-id here**)
.requestEmail()
.build()
Use the value in the OAuth client id section indicated Web client (auto created by google service

You have to upgrade Google Play Services and APIs for the image your emulator is using. Check out this answer, worked out for me (Android Studio 3.1): https://stackoverflow.com/a/49751932/2292056

Related

Error using Place Picker: Could not find method android.content.pm.PackageManager.getPackageInstaller [duplicate]

I am developing an android application as part of a project, and am using Google places API to display places of interest based on location. I am using the PlacePicker Inentbuilder to accomplish this.
However, when the app is run, the place picker launches and then closes immediately (about 1-2 seconds).
I have already implemented the below suggestions (that I got from other answers):
I have generated the public API key for android applications, and am including this in the meta-data tag in the app manifest.
I have enabled the "Google Places API for android" API on the developers console.
I have included the latest play services version in dependencies in build.gradle.
I have included my code and the logcat below. Do let me know if I need to include anything else.
Manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sampath.project.project_v2" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.api_key"
android:value="#string/google_api_key" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_api_key" />"
<activity
android:name=".LoginActivity"
android:label="#string/title_activity_login" >
</activity>
<activity
android:name=".PlacesSample"
android:label="#string/title_activity_places_sample" >
<meta-data
android:name="com.google.android.geo.api_key"
android:value="#string/google_api_key" />
</activity>
</application>
</manifest>
Build.gradle (app module - This is the only module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.sampath.project.project_v2"
minSdkVersion 16
targetSdkVersion 21
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.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:cardview-v7:22.1.1'
compile 'com.android.support:recyclerview-v7:22.1.1'
compile 'com.google.android.gms:play-services:7.3.0'
}
PlacesSample - Activity that is using google places API:
package com.sampath.project.project_v2;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.common.GooglePlayServicesRepairableException;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.ui.PlacePicker;
public class PlacesSample extends AppCompatActivity {
TextView getLocation;
int PLACE_PICKER_REQUEST = 1;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_places_sample);
getLocation = (TextView)findViewById(R.id.getLocTV);
getLocation.setClickable(true);
getLocation.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
Intent intent;
try {
intent = builder.build(getApplicationContext());
startActivityForResult(intent, PLACE_PICKER_REQUEST);
System.out.println("start activity for result");
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_places_sample, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
System.out.println("onActivityResult");
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == RESULT_OK) {
Place place = PlacePicker.getPlace(data, this);
String toastMsg = String.format("Place: %s", place.getName());
Toast.makeText(this, toastMsg, Toast.LENGTH_LONG).show();
}
}
}
}
Logcat:
05-05 23:38:30.593 21408-21408/com.sampath.project.project_v2 I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#17e945c6 time:628772943
05-05 23:38:30.598 21408-21408/com.sampath.project.project_v2 I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#17e945c6 time:628772948
05-05 23:38:31.517 21408-21408/com.sampath.project.project_v2 I/Timeline﹕ Timeline: Activity_launch_request id:com.sampath.project.project_v2 time:628773867
05-05 23:38:31.527 21408-21408/com.sampath.project.project_v2 W/ResourceType﹕ For resource 0x01030224, entry index(548) is beyond type entryCount(9)
05-05 23:38:31.527 21408-21408/com.sampath.project.project_v2 W/ResourceType﹕ For resource 0x01030224, entry index(548) is beyond type entryCount(9)
05-05 23:38:31.636 21408-21408/com.sampath.project.project_v2 I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#2daadb0a time:628773986
05-05 23:38:33.869 21408-21408/com.sampath.project.project_v2 I/System.out﹕ start activity for result
05-05 23:38:34.227 21408-21408/com.sampath.project.project_v2 I/System.out﹕ onActivityResult
05-05 23:38:34.235 21408-21408/com.sampath.project.project_v2 I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#2daadb0a time:628776586
Francois Wouts' solutions helped answer this. Thank you Francois...
I searched the logs with keyword 'Places' and found that Places API was indeed throwing an exception. It expected the com.google.android.geo.API_KEY within the <application> tags in the Manifest.xml.
I had changed to com.google.android.geo.API_KEY in the <activity> tag and not the one in the <application> tag.
Now changed to com.google.android.geo.API_KEY and removed the same lines from <activity> tag, and got it working. Feel like an idiot for not working this out by myself..
The meta-data tag should read android:name="com.google.android.geo.API_KEY"
It should be within the <application> tag in the Manifest.
Have you double checked that your API key is associated with your application (package name and SHA-1 fingerprint of your app's certificate) in the Developer Console?
You can find instructions at Signup and API Keys. Make sure to set it up for both your debug and your release certificates.
I hope that helps!
I was having the same issue. Make sure you enable Google Places API for Android and not just Places API in the Developer Console. "Places API for Android" will not show up under APIs & Auth/APIs because it isn’t a popular API (yet). You will have to search for it using the API search box.
In manifest file com.google.android.geo.api_key and com.google.android.maps.v2.API_KEY shouldnot be same.
go to https://console.developers.google.com/project
login and follow these steps to get key for placepicker places.
create or choose existing > use google apis > Google Places API for Android > enable > credentials in left menu > add credentials > api key > android key > create > copy key.
paste your key at manifest "com.google.android.geo.api_key"
Note : there is a limit of 1000 requests per day for google places api. after you have to pay money. Better to avoid PlacePicker.
In my case there was conflict of APIs. I have added google-service.json file which also had API key and I generated new key for Maps. So place picker was closing immediately.
Solution :
Use single API key which is in google-service.json file
Enable "Places SDK for Android" feature for your Google Cloud Platform project (with same name as in Firebase project , don't use different project. You will find same name project as you are using in Firebase)
Put SHA1 Application Restriction for android app (Recommended)
Check if you have placed following code in Application tag only
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="API_KEY" />
This issue made me crazy as well, there are so many issues regarding exactly this problem, but no one was helpful for me. At the end, I figured out that there are different Google Places APIs especially for Android. Consequently, the API-Key that I was using was simply for the non-Android version.
Generate your key using this link
https://developers.google.com/places/android-api/signup
May be you forgot to add your machine SHA key to the Google Maps Console. Faced same issue, Added my SHA Key to the console, it started working fine.
I filling out the Consent screen in APIs & Auth of the console and its working fine. Check the screen shot.
It was strange that it was a credentials problem for me. It works even without a warning in debugging mode but when i use released version of my app it just doesnt work (i have registered my release and debug sha1 keys) So i removed all restrictions and now its working.
Add compile 'com.google.android.gms:play-services-location:8.1.0' in gradle
I'll just drop this here, maybe it helps someone in the future.
For me, using the wrong Api key caused the crash, even though it worked fine in the past.
I had to use the second key (the one that is auto-created by Google services for Android) instead of the first one which i created.
In my case when I changed current API key with the one which is in google-service.json, it resolved the problem.
In google-services.json:
"api_key": [
{
"current_key": "PASTE THIS API KEY TO THE MANIFEST"
}
]
The PlacePicker is now officially deprecated.
I'm trying to complete the Udacity Advanced Android App Development course and running into the same issue.
https://developers.google.com/places/android-sdk/client-migration#place-picker-deprecation says that
The Place Picker was deprecated on January 29, 2019. It was turned off
on July 29, 2019, and is no longer available. Continued use will
result in an error message. The new SDK does not support the Place
Picker.
Cross-posting to https://github.com/googlemaps/android-places-demos/issues/2
The PlacePicker is now officially deprecated.
Try this library. Light weight and similar to placepicker with some additional features.
https://github.com/BilalSiddiqui/AddressPicker
In my case I had not provided google with my billing account details so the api was was disabled even after enabling it.
If this is also the case for you, add the billing account in the google cloud console and finally you will be able to do it.

Can i disable Firebase plugin for specific flavor?

I'm currently trying out the Firebase analytics suit, but, i have faced one small issue, my app is distributed on both google play and amazon store (which doesn't support google play services), so for the amazon flavor i want to remove the dependency to Firebase (which i already know how to do), but, i also need to remove the Firebase plugin, so that it doesn't throw an exception while building.
This is what i have as far now:
productFlavors {
google {
applicationId 'google app id'
}
amazon {
applicationId 'amazon app id'
}
}
dependencies {
googleCompile 'com.google.firebase:firebase-analytics:9.0.0'
amazonCompile 'com.amazonaws:aws-android-sdk-mobileanalytics:2.2.12'
amazonCompile('com.crashlytics.sdk.android:crashlytics:2.5.1#aar') {
transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'
But, i need to remove the plugin only if is the amazon flavor.
Is this even possible? Or at least is there something close that i can try ?
UPDATE:
As per Steve request, i went and try the version with Firebase on my Amazon Kindle tablets and it does work even thou there's no Google Play Services installed on them.
As per Steve's answer Firebase analytics works even without Google
play services. But we still can disable google services plugin for
flavors.
Try add code like this:
apply plugin: 'com.google.gms.google-services'
android.applicationVariants.all { variant ->
if (!variant.name.contains("flavorName")) {
project.tasks.each { t ->
if (t.name.contains("GoogleServices")) {
// Remove google services plugin
variant.getVariantData().resourceGenTask.getTaskDependencies().values.remove(t);
// For latest gradle plugin use this instead
// variant.getVariantData().taskContainer.sourceGenTask.getTaskDependencies().getDependencies().remove(t)
}
}
}
}
Here I disable google services for all flavors which their name
doesn't contains "flavorName". You should modify the conditions to fit
your requirement. And notice that this should be added after
apply plugin: 'com.google.gms.google-services'. Hope it helps.
I finally got a version to work with new gradle. Tested with gradle 4.6, build tools 3.0.1, google-services plugin 3.1.1
apply plugin: 'com.google.gms.google-services'
android.applicationVariants.all { variant ->
if (variant.name == 'someVariantNameYouDontwantFirebase') {
project.tasks.getByName('process' + variant.name.capitalize() + 'GoogleServices').enabled = false
}
}
Although Firebase does not officially support devices without Google Play services, Analytics should in fact work on such devices and so you may not actually need to disable Firebase (or remove the plugin) in your Amazon build. Have you tried it yet?
It's possible that, because some Google Play Services libraries still need to be included in your firebase-free flavor, that some firebase related entries end up in the final merged AndroidManifest.xml.
So, if, in addition to removing the gradle tasks which were added by the Google Services plugin (as described in Junyue Cao's answer), you want to remove Firebase related receiver, service, provider, uses-permission or other tags from the final merged AndroidManifest, you can add node markers to the AndroidManifest.xml located in the app's flavor, build config, or build variant subdirectory.
If the node markers are set to "remove", then the corresponding receiver, service, provider, uses-permission tags will not be present in the final merged AndroidManifest.xml.
For example, here's what you might add to the AndroidManifest.xml in a project's hypothetical 'nofirebase' flavor source dir (app/src/nofirebase/):
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
tools:node="remove" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
tools:node="remove" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver"
tools:node="remove" />
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
tools:node="remove" >
</receiver>
<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
tools:node="remove" />
<service
android:name="com.google.firebase.iid.FirebaseInstanceIdService"
tools:node="remove"/>
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:authorities="com.you.yourapp.firebaseinitprovider"
tools:node="remove"/>
With answers above I was receiving an error that task doesn't exist (?it was generated during build?). What worked for me was to simply ask tasks to correct themselves. In my case I was disabling Fabric on UAT builds.
tasks.all {
if (it.name.contains("Uat") && (
it.name.contains("GoogleServices") ||
it.name.contains("fabric"))
){
it.enabled = false
}
}

Android App Users Get "App not installed" When Attempting to Update

UPDATE: To those who asked about which error codes the users are receiving: there are no error codes. It just opens a blank, post-installation page that says "The app was not installed" with a big 'X' next to it. It's possible different versions of Android could have different messages. There is no indication for what went wrong during the installation.
UPDATE 2: Some users reported that they receive error code "-504" when they try to install/update from the Play Store, and the "app not installed" message when manually trying to install the .apk. I don't know what correlation this error has with users being unable to install, but the solutions from the only 2 questions on SO on this topic did not fix anything for me. I've included the updated manifests and build files.
UPDATE 3: It appears as users report this issue in versions after IAB has been successfully installed, which further de-legitimatizes the concept that this issue is caused by introducing IAB.
UPDATE 4: It looks like the problem is with old users trying to update to a new version, and not with new users. With that in mind, there is a high likelihood that this issue is result of INSTALL_FAILED_UID_CHANGED. Looking through the version history, the significant change I made in the problematic version that users cannot update from is removing drawables that I no longer intended of using.
Asking users to go through the procedure to fix this isn't plausible. If there is a solution that I can enforce which would fix it for faulty users, wonderful... if not, the least I can do at this point is damage control and ensure this doesn't happen in the future.
NOTE: Below is the original post speculating that the problem is the result of introducing IAB into the app. Since then, it has become more and more unlikely for that to be the cause. Regardless, the post still has relevant information.
------------------------------------------------------------------------------------------
Original Title: Android App Users Get "App not installed" After Introducing IAB
I recently introduced IAB in my app that was published on Google Play. After a while, I've started to get reports from some users that they get an "installation unsuccessful" error when they try to install or update it.
What makes me think it's caused by introducing IAB is that one particular long-time user e-mailed me that when he's attempting to update to the version with IAB, the installer mentions that new permissions were introduced and requires the user's permission. Once granted, it says that the app failed to install.
I've done some Googling and it appears to be a problem from their end, one user even tried to manually install an .apk with said permissions removed without any success. I wan't to make sure that it's not something I've done wrong, but an inevitability that I have to accept with some users.
Note that the vast majority has no problem of installing the app, and I haven't received any reports of this until after IAB was introduced. It wouldn't bother me so much were it a small amount of lost users, but the problem is, those users hurt my app's rating. Users have also mentioned that they can install apps, excluding my own, perfectly well.
I don't rule out the possibility that users may have been getting these errors even before IAB was introduced, and the linkage could be a mistaken one.
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest package = "com.jjsoftware.fullscientificcalculator"
xmlns:android = "http://schemas.android.com/apk/res/android">
<uses-permission android:name = "android.permission.VIBRATE"/>
<uses-permission android:name = "com.android.vending.BILLING"/>
<application
android:allowBackup = "true"
android:fullBackupContent = "true"
android:icon = "#drawable/logo"
android:label = "#string/app_name">
<activity
android:name = ".MainActivity"
android:hardwareAccelerated = "false"
android:label = "#string/app_name"
android:screenOrientation = "portrait"
android:theme="#style/AppTheme">
<intent-filter>
<action android:name = "android.intent.action.MAIN"/>
<category android:name = "android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name = ".SettingsActivity"
android:theme = "#style/PreferencesTheme">
<intent-filter>
<action android:name = ".SettingsActivity"/>
<category android:name = "android.intent.category.PREFERENCE"/>
</intent-filter>
</activity>
</application>
Here is the Gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.jjsoftware.fullscientificcalculator"
minSdkVersion 14
targetSdkVersion 23
versionCode 102
versionName "1.679"
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.android.support:gridlayout-v7:23.2.1'
compile files('libs/exp4j-0.4.5.jar')
compile files('libs/EJML-core-0.28.jar')
compile files('libs/EJML-dense64-0.28.jar')
compile files('libs/Jama-1.0.3.jar')
compile files('libs/EJML-simple-0.28.jar')
}
And, if need be, the top-level build:
// 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:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
There is a typo in the manifest file on line android:largeHeap="true">>. xml line ends with >>. This may be causing the error.
it could be the phones have a lower version of the Google play services than the minimum you defined in the APK.
There is nothing much you can do if that is the case, other than for the users to upgrade their google services (https://play.google.com/store/apps/details?id=com.google.android.gms&hl=en) or you reduce your version.
also you may need to add the following to your manifest. (i think this is used to compare the versions installed in the phones with the versions required by the apk)
<application ...>
<!-- This meta-data tag is required to use Google Play Services. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
I got this error while installing on my Android device a new APK for the app I am developing.
I checked the debug log on the device (using "adb -d logcat > log.txt") and found an entry saying "PackageManager: Downgrade detected: Update version code 2 is older than current 10000". Obviously something went wrong with the versioning somehow.
I uninstalled the package and then was able to install the APK with no problems.
Remember that the latest installment of Android (Marshmallow version) has changed the permissions to give more access to permissions to the user. Hence it is not enough to define the permissions in the manifest anymore.
Through code you need to make sure that the billing permission is enabled by the users when they use the app. The simplest way to go around this is to set the target SDK to v-22. This should temporarily solve your issue.
The real solution however is to handle the new permissions introduced in Marshmallow. Here is how to do it:
#Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
switch(requestCode) {
case BILLING_REQUEST:
if (canAccessBilling()) {
callBillingPerms();
}
break;
}
}
private void callBillingPerms() {
Toast.makeText(this, "We need your permission to access Billing", Toast.LENGTH_SHORT).show();
}
private boolean canAccessSMS() {
return(hasPermission(Manifest.vending.BILLING));
}
#TargetApi(Build.VERSION_CODES.M)
private boolean hasPermission(String perm) {
return(PackageManager.PERMISSION_GRANTED==this.checkSelfPermission(perm));
}
Hope this helps :)
Perhaps the error is on the user's side.
This article states the following:
Google Play - Error 504
Problem
App could not be downloaded due to an error.
First solution
The usual, please: go to Settings > Apps > All > Google Play Store and Clear cache and Clear data. Also Clear cache and Clear data for Google Services Framework.
Second solution
Try removing your GMail account
This Stack Exchange answer discussed similar ideas.
According to the list of status codes at Wikipedia, a 504 error means the following:
504 Gateway Timeout
The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
Ask your users if doing the above solves their issue.

Using Proguard to remove unused classes in Google Play Services library

I'm trying to get rid of unused classes from Google Play Services library. I've created brand new android project with single empty activity. The project does not use anything from Google Play Services library. So I would expect, that when I build release (which includes running proguard in my configuration) I will see no difference in binary size comparing building with/without play-services dependency. But actually, I see ~700 KB difference in apk size.
I've found relatively complex solution, using gradle script, which involves repacking play-services.jar file. Also, this solution requires to specify explicitly each package which is not going to be used. But I don't understand why doesn't proguard do this work in my case?
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
minSdkVersion 10
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
// !!! when I comment the line below, release APK is 700 KB smaller !!! //
compile 'com.google.android.gms:play-services:6.5.87'
}
proguard-rules.pro:
-assumenosideeffects class android.util.Log {
public static *** d(...);
}
AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.noplayservices">
<application android:allowBackup="true"
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:theme="#style/AppTheme">
<activity android:name=".ui.activities.MainActivity" android:icon="#drawable/ic_launcher">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
MainActivity.java:
package com.test.noplayservices.ui.activities;
import android.app.Activity;
import android.os.Bundle;
import com.test.noplayservices.R;
public class MainActivity extends Activity {
#Override
public void onCreate(Bundle savedInstance) {
super.onCreate(savedInstance);
setContentView(R.layout.main_activity);
}
}
From Google Play Services version 6.5 and beyond you can select which individual APIs you want to use, and import just those ones. Maybe that will help you decrease the APK size a little bit. Here's a list:
Google+ com.google.android.gms:play-services-plus:6.5.+
Google Account Login com.google.android.gms:play-services-identity:6.5.+
Google Activity Recognition com.google.android.gms:play-services-location:6.5.+
Google App Indexing com.google.android.gms:play-services-appindexing:6.5.+
Google Cast com.google.android.gms:play-services-cast:6.5.+
Google Drive com.google.android.gms:play-services-drive:6.5.+
Google Fit com.google.android.gms:play-services-fitness:6.5.+
Google Maps com.google.android.gms:play-services-maps:6.5.+
Google Mobile Ads com.google.android.gms:play-services-ads:6.5.+
Google Panorama Viewer com.google.android.gms:play-services-panorama:6.5.+
Google Play Game services com.google.android.gms:play-services-games:6.5.+
Google Wallet com.google.android.gms:play-services-wallet:6.5.+
Android Wear com.google.android.gms:play-services-wearable:6.5.+
Google Actions
Google Analytics
Google Cloud Messaging com.google.android.gms:play-services-base:6.5.+
You can see more about this here.

Update Google Play services. This app won't run unless you update Google Play services

I am currently working on Gcm for sending notifications to android device.
I installed google play services Rev.15 from the SDK manager ->extras and imported and referenced those in my android app.
My android project API level is 17.
In the manifest file i have
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19"/>
This is the manifest of google-play-services_lib
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.gms"
android:versionCode="4242030"
android:versionName="4.2.42 (1018832-030)" >
<uses-sdk android:minSdkVersion="9"/>
</manifest>
I use AVD_for_Nexus_One_by_Google 4.2.2 Api level-17 Target as Google APIs(Google Inc.)
This is the code in my android app to check the play services
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Log.i(TAG, "This device is not supported.");
finish();
}
return false;
}
return true;
}
I get the following error.
Update Google Play services. This app won't run unless you update Google Play Service.
And in the log i find that, google play services is out of date. Requires 4242000 but found 3136130.
Please help me with this. Thanks!
use a real device to test Play Services related stuff.
Emulators are not guaranteed to have Google Play Services out of the box.

Categories

Resources