2013-02-27 39 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合规性级别,而不是项目本身,并且错误消失了!

相关问题