I am having this error after I tidy up my codes into different subpackage name.
ERROR/AndroidRuntime(5879): java.lang.RuntimeException: Unable to instantiate receiver sg.pms.ConnectivityHandler: java.lang.ClassNotFoundException: sg.pms.ConnectivityHandler in loader dalvik.system.PathClassLoader[/data/app/sg.pms-1.apk]
An activity (in the main package) which will execute this code.
package sg.pms;
...
...
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Register a timer to trigger ConnectivityHandler task every 10minutes
Intent intent = new Intent(this, ConnectivityHandler.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this,
234324243, intent, 0);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.setRepeating(AlarmManager.RTC, 0, 60 * 1000,
pendingIntent);
}
ConnectivityHandler class in a subpackage.
package sg.pms.connectivity;
...
public class ConnectivityHandler extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
...
}
}
How do I fix this?
EDIT:
Seems like it may be a bug in Eclipse. I perform a cleanup of the project space and do a build again and it solves this “mislink” problem.
ClassNotFoundException: ConnectivityHandler is giving you the details of the issue.
Are you sure this ConnectivityHandler is still in this package?
It looks to be in