Could not find class 'android.app.Notification$Builder

时光怂恿深爱的人放手 提交于 2020-01-06 01:34:05

问题


I have add into my project's libralies the andriod-support-v4.jar... but I am getting this error:

Could not find class 'android.app.Notification$Builder', referenced from method org.secure.sms.SmsReceiver.showNotification
 Could not find class 'android.support.v4.app.NotificationCompat$Builder', referenced from method org.secure.sms.SmsReceiver.createNotification
 FATAL EXCEPTION: main
 java.lang.NoClassDefFoundError: android.support.v4.app.NotificationCompat$Builder
    at org.secure.sms.SmsReceiver.createNotification(SmsReceiver.java:108)
    at org.secure.sms.SmsReceiver.onReceive(SmsReceiver.java:136)
    at android.app.ActivityThread.handleReceiver(ActivityThread.java:1794)
    at android.app.ActivityThread.access$2400(ActivityThread.java:117)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:981)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:3683)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    at dalvik.system.NativeStart.main(Native Method)

Where is the problem??

Screenshot: http://i.stack.imgur.com/I95ke.jpg


回答1:


be sure to have android-support-v4.jar inside your folder /libs and add this to your class:

import android.support.v4.app.NotificationCompat;


来源:https://stackoverflow.com/questions/21887816/could-not-find-class-android-app-notificationbuilder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!