5

我下载了andengine 动态壁纸示例,但它有一个问题。它显示这些错误:

08-18 04:38:52.606: E/AndroidRuntime(3063): FATAL EXCEPTION: main
08-18 04:38:52.606: E/AndroidRuntime(3063): java.lang.RuntimeException: Unable to instantiate service org.anddev.wallpaper.live.cigarette.LiveWallpaperService: java.lang.ClassNotFoundException: org.anddev.wallpaper.live.cigarette.LiveWallpaperService in loader dalvik.system.PathClassLoader[/data/app/org.anddev.wallpaper.live.cigarette-1.apk]
08-18 04:38:52.606: E/AndroidRuntime(3063):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:1950)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at android.app.ActivityThread.access$2500(ActivityThread.java:121)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:997)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at android.os.Looper.loop(Looper.java:130)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at android.app.ActivityThread.main(ActivityThread.java:3701)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at java.lang.reflect.Method.invokeNative(Native Method)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at java.lang.reflect.Method.invoke(Method.java:507)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at dalvik.system.NativeStart.main(Native Method)
08-18 04:38:52.606: E/AndroidRuntime(3063): Caused by: java.lang.ClassNotFoundException: org.anddev.wallpaper.live.cigarette.LiveWallpaperService in loader dalvik.system.PathClassLoader[/data/app/org.anddev.wallpaper.live.cigarette-1.apk]
08-18 04:38:52.606: E/AndroidRuntime(3063):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
08-18 04:38:52.606: E/AndroidRuntime(3063):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:1947)
08-18 04:38:52.606: E/AndroidRuntime(3063):     ... 10 more

这是我的清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="org.anddev.wallpaper.live.cigarette"
      android:versionCode="4"
      android:versionName="1.0.3">

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

    <uses-feature android:name="android.software.live_wallpaper" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <service 
            android:name="LiveWallpaperService"
            android:enabled="true"
            android:icon="@drawable/icon"
            android:label="@string/service_name"
            android:permission="android.permission.BIND_WALLPAPER">
            <intent-filter android:priority="1" >
                <action android:name="android.service.wallpaper.WallpaperService" />
            </intent-filter>
            <meta-data 
                android:name="android.service.wallpaper" 
                android:resource="@xml/wallpaper" />
        </service>
    </application>

</manifest> 

我不知道这个错误是什么意思。我希望有人可以在这里帮助我运行这个东西..谢谢你..

4

2 回答 2

5

你的错误是ClassNotFoundException关于你的动态壁纸(org.anddev.wallpaper.live.cigarette)。所以我猜你的动态壁纸声明manifest不正确(例如它可能不在应用程序标签中,...)
你可以在关于声明一个这些页面清单中的服务:
developer.android.com/guide/components/services.html
developer.android.com/reference/android/app/Service.html

编辑
我看到了你的清单。似乎你的项目没有Main/Launcher Activity。如果你的项目没有 Main/Launcher Activity,你的服务无法注册,所以当你尝试使用它们时,你会得到ClassNotFoundException
还要确保服务的完全限定类名是android.service.wallpaper.WallpaperService.

于 2012-08-18T05:40:59.360 回答
3

就我而言,我只需要在构建路径中按顺序/导出检查 andengine.jar 和 andenginelivewallpapersupport.jar。(我也使用完全合格的)

于 2012-08-29T11:30:04.113 回答