We are using GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) to check for google services before showing a map. Even though the device has access to play services, the method is throwing an exception when being called. The exception is GooglePlayServicesIncorrectManifestValueException with the message:
“The meta-data tag in your app's AndroidManifest.xml does not have the right value.
Expected 12451000 but found 4323000. You must have the following declaration within the
<application> element:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />”
In the manifest I’ve declared:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
If I go into the play services version, I get:
<integer name="google_play_services_version">12451000</integer>
Which comes from
jetified-play-services-basement-18.1.0/res/values/values.xml
I’ve tried most solutions in other stack overflow posts to no avail. These are all the things I’ve tried and none of them work:
Change tag order in manifest (https://stackoverflow.com/a/37810158/8575762). This has no effect, and also it makes no sense that it should have one.
Make sure we are not providing our own hardcoded version (https://stackoverflow.com/a/63791222/8575762)
Remove the <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" /> tag from the manifest.
Update firebase libraries to latest BOM version (30.5.0)
Remove firebase libraries completely.
Update play services dependencies to latest version(auth, auth-api-phone, vision, wallet, location, safetynet)
Update google services plugin to latest version (4.3.13)
Add tools:node="replace" (also tried other manifest options like node:replace, etc) to the metadata tag & hardcode the version value
If I inspect the AndroidManifest on the built apk (debug), the value of the meta-data tag is the following:
<meta-data
android:name="com.google.android.gms.version"
android:value="#ref/0x7f0b000f" />”.
It’s important to note that this behavior is not 100% consistent. Usually I’ll do a fresh install and the first time I launch the app the isGooglePlayServicesAvailable method returns without crashing. If I restart the app it no longer works.
This seems like a bug in the services implementation library to me, but it feels like something too simple to be failing like that.
Any help would be appreciated, thanks in advance.
Related
I added the package to my app putting the meta data with the API key and all that and it was working ok so I started working on other parts of my app and when I tried to use it again some time later it started giving me this exception:
Unhandled Exception: Platform Exception(error, java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml
its telling me to add the following to my AndroidManifest.xml:
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
however i didn't need this line before and it was working just fine, why is it asking for it out of nowhere? I added it but now its crashing whenever it tries to load the map saying FATAL EXCEPTION: Thread-3. Can anyone help please?
It looks like you are using some kind of Google Mobile Services (GMS) APIs in your app. Google Maps API is one of them. As the error suggests, just add the meta-data to your AndroidManifest.xml to solve the problem. If you read the docs on how to properly set up Google Maps API or other GMS APIs in your app, you can find that you have to define the meta-data on AndroidManifest.xml as well.
Hope this helps.
I read a lot of related posts, but I didn't get the solution.
I use the ActiveAndroid library for the database and released my program, but I having trouble in updating the new version.
In the new version of the application, a table is added to the database. Therefore, the database must be updated.
(I made the changes and increased the database version ).
manifest file:
<meta-data
android:name="AA_DB_NAME"
android:value="KashanTakhfifi" />
<meta-data
android:name="AA_DB_VERSION"
android:value="2" />
<meta-data
android:name="AA_MODELS"
android:value="DBTableModel.TableNotificationModel, DBTableModel.TableGuideModel" />
But when the new app is install or update,The program will be crash.
because happen error: no such table(which means the database is not updated).
I read in the other posts : the app should be removed and reinstalled.
But I've released the app and this problem is not logical for users.
If I want to delete this library, I will have to make a lot of changes to my code...
What is the solution for me.
I'm working on a small Android app which involves Google Maps (created with Android Studio by selecting the Google Maps activity template).
It works fine on my test phone, but when I build a signed APK and install it on another phone, the map is blank.
After some Googling, perhaps the cause of the problem is because I'm using the wrong key.
I have this line in google_maps_api.xml:
<string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">AIzaxxxxxxxxxxxxxxxxxx</string>
Change that into:
<meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzaxxxxxxxxxxxxxxxxxx" />
Android Studio complains:
Error: Can't determine type for tag ''
Pardon the screenshot. For unknown reasons, the whole error message cannot be displayed properly on SO. How to solve this?
The meta-data should be placed in AndroidManifest.xml file witinh application tag.
When uploading an APK to the Android Developer Console, everything goes normal, but there are a certain subset of users on android 5.0 and up that are unable to install or upgrade the APK. These users see a Google Play Store error 505.
There are several different resources that tell you that the 505 error is a conflict of permission. Starting in Android Lollipop, you are no longer able to have duplicate custom permissions with the same name https://developer.android.com/about/versions/android-5.0-changes.html#custom_permissions. If you check stackoverflow for this error you'll find multiple reports of people offering this as a solution. While this can sometimes be the cause of this error there are several other reasons that this, and other conflicts can happen.
1. More than one app defines the same permission
If two completely different apps define the same permission e.g if you have a user and a manager app, and both of them have something along the lines of:
<permission
android:name="same.package.name.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
2. Same app signed by different keys
You have the same app, but signed by different keys. For example if you had a release version and a debug version, you'll hit a conflict because the system sees this as two different apps requesting the same permission.
3. Conflicting authorities
But there is an entirely different situation that can occur, which is less obvious. The 505 error can also occur with conflicting authorities. If two different apps declare the same provider, such as
<provider
android:name=".provider.YourProvider"
android:authorities="com.roqbot.client.YourProvider"
android:exported="false" />
This can also provide a conflict.
The last, and hardest conflict to spot, is one that can happen with Google Play Services 8.1 and up. If you do not define an application id in your build.gradle file like this:
defaultConfig {
applicationId "com.example.my.app"
}
it is possible that it will auto-generate a provider that can conflict with other apps. To check this, go into your your build>intermediates>manifests>full>release>AndroidManifest.xml and look for
<provider
android:name="com.google.android.gms.measurement.AppMeasurementContentProvider"
android:authorities="com.google.android.gms.google_measurement_service"
android:exported="false" />
Here the authority name will conflict with other apps. If you add the applicationId to the default config, it will change this authority to
<provider
android:name="com.google.android.gms.measurement.AppMeasurementContentProvider"
android:authorities="com.example.my.app.google_measurement_service"
android:exported="false" />
This is very subtle and appears to be a bug starting in google play services 8.1. The issue can be seen discussed here. https://code.google.com/p/android/issues/detail?id=189079&can=1&q=error%20505&sort=-opened&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened
The point to remember is that it may be several things, and the only thing you can verify for sure with a 505 error is that there is a conflict of some sort, and that it may or may not necessarily be a custom permission conflict.
If you are using the Facebook SDK and following the official sample code, you might also encounter the issue. In my case, I was using a same content provider name on 2 different app's manifest.
<provider
android:authorities="com.facebook.app.FacebookContentProvider123"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
I forgot to change the default name com.facebook.app.FacebookContentProvider123. Finally fixed it by adding a dynamic applicationId as provider name.
<provider
android:authorities="com.facebook.app.FacebookContentProvider.${applicationId}"
android:name="com.facebook.FacebookContentProvider"
android:exported="true" />
Name Of The Error: Error 505
Problem: This is an unusual error code which is encountered during the updation or installation of the application from Google Play store. It shows up an error message stating “Unknown error code during Application installs 505”.
Following reasons are responsible for this error.
• It is mostly seen when you try to install an outdated version of the app.
• Error 505 can be caused due to the incompatibility of the app with your Android OS version.
• It can also arise due to cache conflict or data crash of the app.
• Error 505 may also arise due to Google Account Sync Problem.
Solution:
• At first restart your Android device, because this step usually works in getting rid off of any type of error. If it didn’t work and then try these simple steps.
• Clear Cache and Data of Google Play Store, Google Service Framework and Download Manager. To do this First of all go to Settings >> then Apps >> select All >> then Google Play Store and Clear cache and Clear data. Also Clear cache and Clear data for Google Services.
I tried to upgrade my implementation of AdMob. Using the GoogleAdMobSDK, I would like to turn into the google-play-services-lib.
The ad appears. So it seems ok, but I still got this error at the method call loadAd() in log
Requesting resource 0x7f0c000d failed because it is complex
GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
Here's my checklist:
I import the library project in my workspace, copying the source.
I reference the library into my project
I add the meta-data in the Manifest
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
My code
this.request = new AdRequest.Builder().addTestDevice(id).build();
this.adView = new AdView(context);
this.adView.setAdUnitId(MY_AD_UNIT_ID);
this.adView.setAdSize(AdSize.SMART_BANNER);
...
this.adView.loadAd(request);
The target version for my app in 9 (2.3). I test on Nexus 5 with KitKat version.
I also tried to put the google-play-services-lib jar in the properties, but no result.
I want to be sure that this error could be handle before submit my app.
This is a benign error with the current version of Google Play Services.
Don't worry about it. Submit your app. Get some sleep.