我已经在我的项目库中添加了android-support-v4.jar ......但是我收到了这个错误:
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)
问题在哪里?
答案 0 :(得分:1)
确保文件夹android-support-v4.jar
内有/libs
并将其添加到您的班级:
import android.support.v4.app.NotificationCompat;