2013-05-06 40 views
0

試圖根據用戶使用phonegap android設置使用科爾多瓦2.2.0設置的日期和時間提醒或提醒有從這裏下載phonegap localnotification插件: phonegap android localnotification plugin 我剛剛達到其初始階段,並獲得此行的錯誤文件命名爲:ALARMRECEIVER.JAVA:phonenot android localnotification?

// Construct the notification and notificationManager objects 
     final NotificationManager notificationMgr = (NotificationManager) systemService; 
     final Notification notification = new Notification(R.drawable.ic_launcher, tickerText, 
       System.currentTimeMillis()); 
     final PendingIntent contentIntent = PendingIntent.getActivity(context, 0, new Intent(), 0); 
     notification.defaults |= Notification.DEFAULT_SOUND; 
     notification.vibrate = new long[] { 0, 100, 200, 300 }; 
     notification.setLatestEventInfo(context, notificationTitle, notificationSubText, contentIntent); 

     /* 
     * If you want all reminders to stay in the notification bar, you should 
     * generate a random ID. If you want do replace an existing 
     * notification, make sure the ID below matches the ID that you store in 
     * the alarm intent. 
     */ 
     notificationMgr.notify(notificationId, notification); 

誤差只有這一行:

final Notification notification = new Notification(R.drawable.ic_launcher, tickerText, 
       System.currentTimeMillis()); 

紅色亮顯顯示我:

R cannot be resolved to a variable 

只是因爲一個錯誤無法運行此項目

回答

0

從插件自述:

修復進口在AlarmReceiver.java周圍67行,其中 R.drawable.ic_launcher引用這樣它與您的 項目中的圖標相匹配

確保在/ res /文件夾中有一個名爲ic_launcher的圖標。然後檢查你的/ res /文件夾中的任何文件中是否沒有任何XML錯誤。 R類是從你的/ res /文件夾自動生成的,如果缺少某些東西,或者如果有錯誤的XML等,它將不會被創建,導致這個錯誤。如果您仍然遇到錯誤,請嘗試執行Make - > Clean。在StackOverflow上還有一些關於丟失R文件或R沒有生成的其他問題。

相關問題