Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LiveWallpaper Andengine example error

I downloaded the andengine live wallpaper example but it has a problem. It shows these error:

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

here is my manifest:

<?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> 

I Dont have any idea what this error means. I hope someone can help me here to run this thing.. Thank You..

like image 682
CodeAndWave Avatar asked Aug 18 '12 04:08

CodeAndWave


2 Answers

Your error is ClassNotFoundException and it is in about your live wallpaper(org.anddev.wallpaper.live.cigarette).So I guess that your declaration of live wallpaper in manifest is incorrect(for example it may be not in application tag,...)
You can see more details in about declaring a service in the manifest in these pages:
developer.android.com/guide/components/services.html
developer.android.com/reference/android/app/Service.html

Edit:
I saw your manifest.It seems that your project has no Main/Launcher Activity.If your project has no Main/Launcher Activity,your services can not be registered and so when you try to use them,you get ClassNotFoundException.
Also be sure that fully qualified class name of service is android.service.wallpaper.WallpaperService.

like image 66
hasanghaforian Avatar answered Oct 05 '22 23:10

hasanghaforian


In my case I just needed to check andengine.jar and andenginelivewallpapersupport.jar in order/export in build path. (Also I use fully qualified )

like image 21
Taras Avatar answered Oct 06 '22 01:10

Taras