Reputation: 2740
I'm working in a massive use app that has been working for about 4 years, in the last release was implemented some new libraries, after that implementation we have facing some issues when trying to check if Google Play Services are available, this only happens on Huawei devices with Android 8+. The logcat show us this stack trace
Caused by: java.lang.IllegalStateException: 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 element:
We have the correct values on 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"
android:value="XXXXXXXXXXXXXXXXXXXXXX" />
If we follow the value of google_play_services_version, we can found the expected value from play-services-basement-16.1.0.aar
<integer name="google_play_services_version">12451000</integer>
This are the libs implemented on gradle
implementation "com.android.support.constraint:constraint-layout:$constraint"
implementation "com.android.support:appcompat-v7:$support"
implementation "com.android.support:design:$support"
implementation "com.android.support:cardview-v7:$support"
implementation "com.android.support:recyclerview-v7:$support"
implementation "com.android.support:design:$support"
implementation "com.android.support:support-v4:$support"
implementation "com.android.support:mediarouter-v7:$support" //New Lib
implementation "com.android.support:animated-vector-drawable:$support" //New Lib
implementation "com.android.support:design:$support"
implementation "com.android.support:support-vector-drawable:$support"
//Play services
implementation "com.google.android.gms:play-services-maps:$playServices"
implementation "com.google.android.gms:play-services-analytics:$playServices"
implementation "com.google.android.gms:play-services-gcm:$playServices"
implementation "com.google.android.gms:play-services-safetynet:$playServices"
implementation "com.google.android.gms:play-services-wearable:$playServices"
With this versions
ext {
//build
sdkCompileVersion = 27
sdkMinVersion = 16
sdkTargetVersion = 27
sdkBuildToolsVersion = '27.0.3'
//dependencies
support = '27.1.0'
playServices = '16.0.0'
newRelic = '5.18.0'
constraint = '1.1.2'
}
Does anyone have an idea how to solve this issue?
Upvotes: 4
Views: 1337
Reputation: 55
Did you hardcode value of gms version anywhere in your application? Something like this
applicationInfo.metaData.putInt("com.google.android.gms.version", 4323000);
It is also possible that one of the new libraries that you added also declares an older/different com.google.android.gms.version
.
If it is happening on Huawei only, then it’s possible that Huawei is attempting to override with some value.
To confirm whether it’s your own libraries or Huawei, you will have to hardcode it into the manifest, then analyze your built apk and inspect the final value that’s merged in there. If that value is as expected, then it’s probably Huawei’s doing.
You can also try this link: https://stackoverflow.com/a/52249677/6668797
If a library is using an old/different version, then this will override it with yours.
If it is still not resolve the issue, can you please provide the following details: Please share the complete stack trace. Is it happening on any Nexus/Pixel devices? Which of those libraries are newly added?
Upvotes: 1