Error AMM0000 after updating Android project to .NET 8.0 and Android Target OS Version 34.0

Kim Strasser 1,101 Reputation points
2024-06-01T13:39:25.6066667+00:00

I get many errors after updating my Android project to .NET 8.0 and Android Target OS Version 34.0. I use Visual Studio Version 17.10.1 on my Windows 11 laptop.

Error (active) AMM0000 C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\253\jl\AndroidManifest.xml Warning: Namespace 'com.google.firebase.installations' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\248\jl\AndroidManifest.xml Warning: Namespace 'com.google.firebase.datatransport' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\255\jl\AndroidManifest.xml Warning: Namespace 'com.google.firebase.analytics.connector' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\245\jl\AndroidManifest.xml Warning: Namespace 'com.google.firebase' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\250\jl\AndroidManifest.xml Warning: Namespace 'com.google.firebase.encoders.json' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\254\jl\AndroidManifest.xml Warning: Namespace 'com.google.firebase.installations.interop' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\256\jl\AndroidManifest.xml Warning: Namespace 'com.google.firebase.messaging' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\264\jl\AndroidManifest.xml Warning: Namespace 'com.google.android.gms.cloudmessaging' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\263\jl\AndroidManifest.xml Warning: Namespace 'com.google.android.gms.common' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\267\jl\AndroidManifest.xml Warning: Namespace 'com.google.android.gms.tasks' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\266\jl\AndroidManifest.xml Warning: Namespace 'com.google.android.gms.stats' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\243\jl\AndroidManifest.xml Warning: Namespace 'com.android.billingclient' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\247\jl\AndroidManifest.xml Warning: Namespace 'com.google.firebase.components' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\262\jl\AndroidManifest.xml Warning: Namespace 'com.google.android.gms.base' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\246\jl\AndroidManifest.xml Warning: Namespace 'com.google.firebase.ktx' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\265\jl\AndroidManifest.xml Warning: Namespace 'com.google.android.gms.location' used in: AndroidManifest.xml, AndroidManifest.xml. C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\lp\252\jl\AndroidManifest.xml Warning: Namespace 'com.google.firebase.iid.internal' used in: AndroidManifest.xml, AndroidManifest.xml. Attribute meta-data#com.google.android.play.billingclient.version@value value=(6.0.1) from AndroidManifest.xml:32:77-98 is also present at AndroidManifest.xml:21:13-34 value=(6.1.0). Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:32:5-101 to override. Directory 'obj\Debug\net8.0-android34.0\lp\253' is from 'firebase-installations.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\248' is from 'firebase-datatransport.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\255' is from 'firebase-measurement-connector.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\245' is from 'firebase-common.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\250' is from 'firebase-encoders-json.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\254' is from 'firebase-installations-interop.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\256' is from 'firebase-messaging.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\264' is from 'play-services-cloud-messaging.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\263' is from 'play-services-basement.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\267' is from 'play-services-tasks.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\266' is from 'play-services-stats.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\243' is from 'billing.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\247' is from 'firebase-components.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\262' is from 'play-services-base.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\246' is from 'firebase-common-ktx.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\265' is from 'play-services-location.aar'. Directory 'obj\Debug\net8.0-android34.0\lp\252' is from 'firebase-iid-interop.aar'. ProjAndroid C:\Users...\ProjAndroid\obj\Debug\net8.0-android34.0\AndroidManifest.xml 32

My AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.6" android:versionCode="26">

<uses-sdk android:minSdkVersion="31" android:targetSdkVersion="34" />

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<application android:icon="@mipmap/icon" android:label="@string/app_name">

<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />

<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">

<intent-filter>

<action android:name="com.google.android.c2dm.intent.RECEIVE" />

<action android:name="com.google.android.c2dm.intent.REGISTRATION" />

<category android:name="${applicationId}" />

</intent-filter>

</receiver>

<service android:name="crc64572fdef0b95375c7.MyFirebaseMessagingService" android:exported="false">

<intent-filter>

<action android:name="com.google.firebase.MESSAGING_EVENT" />

</intent-filter>

</service>

<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_stat_name1" />

<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/custom_color" />

</application>

</manifest>

MyFirebaseMessagingService.cs:

using System;

using Android.App;

using Android.Content;

using Android.Util;

using Firebase.Messaging;

using System.Collections.Generic;

using AndroidX.Preference;

using Android.Media;

using AndroidX.Core.App;

using AndroidX.Core.Content;

using Android.Graphics;

namespace ProjAndroid

{

[Service]

[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]

public class MyFirebaseMessagingService : FirebaseMessagingService

{

const string TAG = "MyFirebaseMsgService";

public override void OnNewToken(string token)

{

Log.Debug(TAG, "Refreshed token: " + token);

storeToken(token);

}

private void storeToken(String token)

{

//saving the token on shared preferences

ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context);

ISharedPreferencesEditor editor = prefs.Edit();

editor.PutString("my_token", token);

editor.Apply(); // newer APIs

}

public override void OnMessageReceived(RemoteMessage message)

{

Log.Debug(TAG, "From: " + message.From);

var body = message.GetNotification().Body;

var title = message.GetNotification().Title;

var sound = message.GetNotification().Sound;

var colortest = message.GetNotification().Color;

Log.Debug(TAG, "Notification Message Body: " + message.GetNotification().Body);

SendNotification(body, title, sound, colortest, message.Data);

}

void SendNotification(string messageBody, string Title, string messageSound, string messageColor, IDictionary<string, string> data)

{

var intent = new Intent(this, typeof(Activity1));

intent.AddFlags(ActivityFlags.ClearTop);

foreach (var key in data.Keys)

{

intent.PutExtra(key, data[key]);

}

var pendingIntent = PendingIntent.GetActivity(this, Activity1.NOTIFICATION_ID, intent, PendingIntentFlags.Immutable);

int color = Color.Argb(255, 76, 178, 252);

var notificationBuilder = new NotificationCompat.Builder(this, Activity1.CHANNEL_ID)

.SetSmallIcon(Resource.Drawable.ic_stat_name1)

.SetColor(color)

.SetContentTitle(Title)

.SetContentText(messageBody)

.SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Notification))

.SetVibrate(new long[] { 1000, 1000, 0, 0, 0 })

.SetLights(Android.Graphics.Color.Red, 3000, 3000)

.SetPriority((int)NotificationPriority.High)

.SetAutoCancel(true)

.SetContentIntent(pendingIntent);

var notificationManager = NotificationManagerCompat.From(this);

notificationManager.Notify(Activity1.NOTIFICATION_ID, notificationBuilder.Build());

}

}

}

What should I change in my Android project?

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,713 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Kim Strasser 1,101 Reputation points
    2024-06-04T13:12:34.3666667+00:00

    I have added the following two lines to my .csproj file and now I don't get the JAVA0000 anymore. https://github.com/xamarin/GooglePlayServicesComponents/issues/852

    <PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.4.0.1" /> <PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.4.0.1" />

    In addition, I found out that the NuGet package Plugin.InAppBilling (7.1.2-beta) created the AMM0000 error. I removed this package and installed the NuGet package Plugin.InAppBilling (7.1.0) and now it works.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.