2013-02-27 75 views
1

我得到了一個帶有靜態廣播接收器的ClassNotFoundException。在設備上通過eclipse安裝應用程序時會引發異常。我正在開發索尼smartwatch擴展,所以我需要使用sony sdk的「SmartExtensionUtils」項目。只要我在代碼示例項目中工作,一切都很好。我使用Maven + Android開始了一個新項目,現在它不再工作了!不知道爲什麼?!?我想用東西包了問題....Android/Sony Smartwatch:無法實例化接收器(ClassNotFoundException)

我得到了以下錯誤:

E/AndroidRuntime(11201): java.lang.RuntimeException: Unable to instantiate receiver com.bla.move.smartwatch.sony.ExtensionReceiver: java.lang.ClassNotFoundException: com.bla.move.smartwatch.sony.ExtensionReceiver 

我的廣播接收器類叫做ExtensionReceiver。清單文件中的名稱是相同的...

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.bla.move.smartwatch.sony" 
    android:versionName="1.0" android:versionCode="1"> 

<uses-sdk android:minSdkVersion="7"/> 

<uses-permission 
    android:name="com.sonyericsson.extras.liveware.aef.EXTENSION_PERMISSION" /> 

<application android:icon="@drawable/icon" android:label="@string/app_name"> 
    <activity android:name="SmartWatchPreferenceActivity" android:label="@string/preference_activity_title"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
     </intent-filter> 
    </activity> 

    <service android:name=".SmartWatchExtensionService" /> 

    <receiver android:name=".ExtensionReceiver"> 
    <intent-filter> 
     ..... 
    </intent-filter> 
    </receiver> 
    .... 

可能是什麼問題?有什麼建議麼???我做了alreday清理+重建(幾次)!

+0

注意:您在SmartWatchPreferenceActivity前缺少一個點 – RvdK 2013-02-27 13:49:44

+0

愚蠢的問題即將到來:接收器類確實存在於您的項目中正確的包中? – Thrakbad 2013-02-27 14:53:32

+0

是的,它存在! ;-)在(唯一)包「com.bla.move.smartwatch.sony」中...... – edererm 2013-02-27 14:59:57

回答

0

您是否在項目和Maven中都包含SmartExtensionAPISmartExtensionUtil項目作爲依賴關係?

0

嘗試清理工作區(使用-clean標誌啓動Eclipse),並確保項目的JDK合規性設置設置爲1.6(不是1.7)!這對我有效。我設置了整個工作區的JDK合規性級別,而不是項目本身,並且錯誤消失了!

相關問題