2014-02-19 47 views
1

我已經加入到我的項目的libralies安卓支持 - 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) 

在哪裏問題??

截圖:http://i.stack.imgur.com/I95ke.jpg

+0

你添加此導入? **導入android.support.v4.app.NotificationCompat; ** –

+0

不,從android SDK中的額外forlder只是android-support-v4.jar。這個進口在哪裏?添加它? –

+0

在您的活動的頂部,在其他導入語句中,手動添加該導入(如我以粗體寫的) –

回答

1

一定要有android-support-v4.jar您的文件夾/libs 內添加到您的類:

import android.support.v4.app.NotificationCompat; 
+0

我安裝了API 8並解決了問題!謝謝! –