Unable to instantiate receiver java.lang.ClassNotFoundException

I have also faced with this problem. Adding full package name to receiver definition in manifest file didn't help. Problem was there was an old odex file corresponding to my apk file. Android system loads classes from odex file so can not find receiver class.

Workarounds:

  • Remove the old odex file, or
  • Give a new name to your apk

http://www.addictivetips.com/mobile/what-is-odex-and-deodex-in-android-complete-guide/


You have to put your Receiver in some package. The system won't be able to instantiate it if it is on the main package.

I had the same problem. Fortunately before searching the error on internet I was doing another java project. I just realized that the bug in there was similar to this one. I tried it just now and worked. :)


try:

<receiver android:name=".BootReceiver" >

It adds the package name itself because you defined:

package="dti.obd.reader"