android - BroadcastReceiver java.lang.ClassNotFoundException -


i try show simple toast message on phone startup. wasted day trying figure out why code did not work.

here full error:

unable instantiate receiver com.debug.receivebootcomplete.debug.broadcastreceiverclass: java.lang.classnotfoundexception: com.debug.receivebootcomplete.debug.broadcastreceiverclass 

manifest file:

<?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.debug.receivebootcomplete.debug">     <uses-sdk android:minsdkversion="10" />     <uses-permission android:name="android.permission.receive_boot_completed" />     <application android:allowbackup="true" android:icon="@mipmap/icon" android:label="@string/app_name">         <receiver android:name=".broadcastreceiverclass" android:exported="true">             <intent-filter>                  <action android:name="android.intent.action.boot_completed" />              </intent-filter>          </receiver> </application> </manifest> 

and class:

namespace debug {     class broadcastreceiverclass:broadcastreceiver     {         public override void onreceive (context context, intent intent)         {             toast.maketext (context,"work",toastlength.short).show ();         }     } } 

in emulator debug application throw java.lang.classnotfoundexception , on phone when reboot application crash.

thank in advance!

thanks @talha!

my error generated intent-filter tag. have no idea why because in every topic saw used tag in manifest file.

        <intent-filter>              <action android:name="android.intent.action.boot_completed" />          </intent-filter> 

so remove , add [broadcastreceiver] [intentfilter(new[] {intent.actionbootcompleted})]

to broadcastreceiver class.


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -