Android 11 app crashes with "The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 12451000 but found 4323000. "

2,607 views
Skip to first unread message

Gokberk

unread,
Apr 29, 2021, 7:51:46 AM4/29/21
to Google Mobile Ads SDK Developers
Hi ,

I am getting crash on Android 11 devices. If I understood correctly Ads SDK overwrites the play version value to 4323000. But Google's other libraries throws exception when the current version is not 12451000.


The smali code was copied from getApplicationInfo method which is in com/google/ads/conversiontracking/a$b.smali. 

.line 128
    :cond_0
    iget-object p1, v0, Landroid/content/pm/ApplicationInfo;->metaData:Landroid/os/Bundle;

    const p2, 0x41f6b8

    const-string v1, "com.google.android.gms.version"

    invoke-virtual {p1, v1, p2}, Landroid/os/Bundle;->putInt(Ljava/lang/String;I)V

    :cond_1
    return-object v0

I think it equals to following code ,
applicationInfo.metaData.putInt(“com.google.android.gms.version”, 4323000)

  com.google.android.gms.common.GooglePlayServicesIncorrectManifestValueException: 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" />
    at com.google.android.gms.common.GooglePlayServicesUtilLight.isGooglePlayServicesAvailable(com.google.android.gms:play-services-basement@@17.5.0:19)

I am getting this exception when i try to call

GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
final int resultCode = googleApiAvailability.isGooglePlayServicesAvailable(this.conf.getContext());



Gokberk

unread,
Apr 29, 2021, 7:53:31 AM4/29/21
to Google Mobile Ads SDK Developers
Btw 0x41f6b8 hex code equals to 4323000.

Mobile Ads SDK Forum Advisor Prod

unread,
Apr 29, 2021, 12:49:21 PM4/29/21
to gokbe...@gmail.com, google-adm...@googlegroups.com
Hi Gokberk,

Thank you for bringing this question to our attention. In reading over this, it would appear that you are having an issue with Google Ads? And not the AdMob SDK, but if you can give us more context within regards to the SDK. We might be able to help you.

Regards,
Google Logo
William Pescherine
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2GIaYv:ref
Message has been deleted

Gokberk

unread,
Apr 29, 2021, 1:12:24 PM4/29/21
to Google Mobile Ads SDK Developers
Hi, 

Yes i am using Google Ads for Google DoubleClick for Publishers. I have multiple google service libraries and their Gms version is 12451000. My app works fine on debug build there is no crash. But release version throw exception which i mentioned before. I think it also related proguard.

Also i have a meta-data at manifest file it indicates the Gms version what is 12451000.

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

/jetified-play-services-basement-17.5.0/res/values/values.xml


Here are my other google play dependencies,

implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation "com.google.firebase:firebase-messaging:21.0.1"
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-ads:19.8.0'
implementation 'com.google.firebase:firebase-appindexing:19.2.0'
implementation 'com.google.android.gms:play-services-auth-api-phone:17.5.0'
implementation 'com.google.firebase:firebase-crashlytics:17.4.1'
implementation 'com.google.firebase:firebase-analytics:18.0.2'


I am just checking google availability with these two lines,

GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
final int resultCode = googleApiAvailability.isGooglePlayServicesAvailable(this.conf.getContext());

This code lines works on GooglePlayServicesUtilLight

@Deprecated
@KeepForSdk
public static int isGooglePlayServicesAvailable(@RecentlyNonNull Context var0, int var1) {
try {
var0.getResources().getString(string.common_google_play_services_unknown_issue);
} catch (Throwable var5) {
Log.e("GooglePlayServicesUtil", "The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.");
}

if (!"com.google.android.gms".equals(var0.getPackageName()) && !zze.get()) {
int var4;
if ((var4 = zzt.zzb(var0)) == 0) {
throw new GooglePlayServicesMissingManifestValueException();
}

if (var4 != GOOGLE_PLAY_SERVICES_VERSION_CODE) {
throw new GooglePlayServicesIncorrectManifestValueException(var4);
}
}

boolean var2 = !DeviceProperties.isWearableWithoutPlayStore(var0) && !DeviceProperties.zza(var0);
return zza(var0, var2, var1);
}

GOOGLE_PLAY_SERVICES_VERSION_CODE is 12451000. It throws exception as i stated, i think Google Ads overwrites my manifest version to 4323000. 

I am using Google Ads everywhere in my project, but i will try to run my app without Google Ads today. If i do not get any crash im gonna make sure Google Ads causes this problem.  

Mobile Ads SDK Forum Advisor Prod

unread,
Apr 29, 2021, 2:29:54 PM4/29/21
to gokbe...@gmail.com, google-adm...@googlegroups.com
Hi Gokberk,

I work with William and will assist you. If you can replicate this issue in a minimally modified Ad Manager Sample Banner Project we would like to look at it. You may send it privately or via our testing alias mobileads...@gmail.com with a post on this thread once you have done so.

Regards,

Google Logo
Aryeh Baker
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2GIaYv:ref

Mobile Ads SDK Forum Advisor

unread,
Jun 10, 2021, 1:39:48 PM6/10/21
to gokbe...@gmail.com, google-adm...@googlegroups.com
Hi Gokberk,

After consultation with my team I have some information to pass on:
 

Users don't need to (and should not) explicitly include

 

<meta-data

android:name="com.google.android.gms.version"

android:value="xxx" />

 

In their AndroidManifest.xml anymore. When they include a Google Play services dependency, one of those .aar files has this flag that gets manifest merged into the user's project.

 

If the user has this explicitly, and THINKS they are using 1 version, but some dependency requires a newer version and the manifest merge wanted a different value, there could be that inconsistency at runtime.

 

Recommendation: Publisher should remove <meta-data

android:name="com.google.android.gms.version" ...> from their app's AndroidManifest.xml file.

Please get back to us if this doesn't help you.

Regards,

Gokberk

unread,
Jun 10, 2021, 3:21:09 PM6/10/21
to Google Mobile Ads SDK Developers

Hi 

I have found suspected code line which causes exception in GoogleConversionTrackingSdk-2.2.4.jar which is not provided by you.

We have found a temporary workaround to avoid a crash. And our next step is understanding why our app is using this library then removing it from the app. But if we use a 3rd party library there will always be a risk. Maybe some restrictions can be made by the Google team that moving version info to a more secure and read-only place.


Screen Shot 2021-06-10 at 22.19.38.png


Thanks.

Mobile Ads SDK Forum Advisor

unread,
Jun 11, 2021, 1:39:25 AM6/11/21
to gokbe...@gmail.com, google-adm...@googlegroups.com
Hi there,

I work along with Aryeh and William. Thank you for sharing your findings. Could you share the workaround that you made?

Also, I've checked this thread, and can see that this has been raised to the team. Could you confirm if the previous recommendations works on your end?

Regards,
Google Logo
Teejay Wennie Pimentel
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2GIaYv:ref

Jaguan Hsu

unread,
Jun 29, 2022, 4:39:46 AM6/29/22
to Google Mobile Ads SDK Developers
Hi , I'm facing the similar issue , following is my case:

build.gradle:

implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-wallet:16.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
implementation 'com.google.android.gms:play-services-ads:21.0.0'



AndroidManifest.xml:

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />



I'm trying to integrate google ads and wallet at the same time in my app. Unfortunately I got the following error
error.png

should I remove 

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />


in my AndroidManifest.xml ?

mobileadssdk 在 2021年6月11日 星期五下午1:39:25 [UTC+8] 的信中寫道:

Mobile Ads SDK Forum Advisor

unread,
Jun 29, 2022, 10:06:35 AM6/29/22
to gigiga...@gmail.com, google-adm...@googlegroups.com

Hi Jaguan,

Thank you for reaching out to us.

As per checking on the previous response of my colleague, the recommendation on this is you should remove <meta-data android:name="com.google.android.gms.version" ...> from your app's AndroidManifest.xml file. Kindly let us know if this works for you.

Regards,

Google Logo
Princess Pamela
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2GIaYv:ref

Jaguan Hsu

unread,
Jun 29, 2022, 11:18:34 AM6/29/22
to Google Mobile Ads SDK Developers
Thanks for response quickly. I will share this to our team and feedback here.

mobileadssdk 在 2022年6月29日 星期三晚上10:06:35 [UTC+8] 的信中寫道:

Jaguan Hsu

unread,
Jun 29, 2022, 10:28:27 PM6/29/22
to Google Mobile Ads SDK Developers
Hi , I want to make sure one thing. Should I remove 

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />


in any Android SDK version (no matter what version)?


mobileadssdk 在 2022年6月29日 星期三晚上10:06:35 [UTC+8] 的信中寫道:

Hi Jaguan,

Mobile Ads SDK Forum Advisor

unread,
Jun 30, 2022, 3:00:39 AM6/30/22
to gigiga...@gmail.com, google-adm...@googlegroups.com

Hi Jaguan,

As the rest of the team mentioned, you should remove the <meta-data android:name="com.google.android.gms.version" ...>. The team mentioned that, when you include a Google Play services dependency, one of those .aar files has this flag that gets manifest merged into the user's project. Just let us know if you encounter any errors on this when you remove the recommended approach on this.

Reply all
Reply to author
Forward
0 new messages