I am creating an Android app with Xamarin.Forms 4.8 and need to add the namespace "Android.Media" to be able to use the MediaPlayer class.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
using Android.Media;
namespace Breakapp
{
public partial class MainPage : ContentPage
{
int seconds = 0;
int minutes = 0;
public MainPage()
{
InitializeComponent();
}
protected override void OnAppearing()
{
base.OnAppearing();
minutes = Convert.ToInt32(Minutes.Text);
seconds = Convert.ToInt32(Seconds.Text);
Device.StartTimer(TimeSpan.FromSeconds(1), () =>
{
.....
However, as soon as I try to add it by using the using directive, I get the following error:
CS0246 The type or namespace name 'Android' could not be found (are you missing a using directive or an assembly reference?)
As I looked up the error message I found out that others fixed this error by adding the "Mono.Android" assembly as a reference to their project. But this assembly is already added. I already tried removing the assembly and readding it but it didn't work at all.