Hi,
I'm working on a fairly simple program and for some reason my app builds and deploys without problems, however when a section in my main activity tries to access an android class it throws this error: [AndroidRuntime] Caused by: java.lang.ClassNotFoundException: Didn't find class "com.pkg.sav.InterceptCall" on path: DexPathList[[zip file "/data/app/com.pkg.sav-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.pkg.sav-1, /system/lib]]
I'm not sure why this is happening. I've included my manifest, mainactivity, and class. Any help is appreciated.
AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest
xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1"
android:versionName="1.0" package="com.pkg.sav">
<uses-sdk
android:minSdkVersion="15" android:targetSdkVersion="15" />
<application
android:label="MinuteSaver" android:icon="@drawable/icon">
<receiver android:name="InterceptCall">
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CALL_PRIVILEGED" />
</manifest>
-- MainActivity.cs
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using MinuteSaver;
namespace MinuteSaver
{
[Activity (Label = "MinuteSaver", MainLauncher = true)]
public class MainActivity : Activity
{
private InterceptCall _recevier;
int count = 1;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button> (Resource.Id.myButton);
button.Click += delegate {
button.Text = string.Format ("{0} clicks!", count++);
};
_recevier = new InterceptCall();
RegisterReceiver (_recevier, new IntentFilter (Intent.ActionNewOutgoingCall));
}
protected override void OnResume()
{
base.OnResume();
RegisterReceiver(_recevier, new IntentFilter(Intent.ActionNewOutgoingCall));
}
protected override void OnPause()
{
base.OnPause();
UnregisterReceiver(_recevier);
}
}
}
InterceptCall.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
namespace MinuteSaver
{
[BroadcastReceiver (Enabled = true, Exported = false)]
public class InterceptCall : BroadcastReceiver
{
public override void OnReceive (Context context, Intent intent)
{
Toast notifyUser = Toast.MakeText(context, "test", ToastLength.Long);
if (intent.Action == Intent.ActionNewOutgoingCall)
{
notifyUser.Show();
//Toast.MakeText("Outgoing call detected", ToastLength.Short).Show;
//((MainActivity)context).Connected();
}
if (intent.Action == Intent.ActionPowerDisconnected)
{
//((MainActivity)context).Disconnected();
}
}
}
}