0

这是代码:

import android.service.wallpaper.WallpaperService;
import android.view.SurfaceHolder;

public class devwallpaper extends WallpaperService {

    @Override
    public Engine onCreateEngine() {
        return new NWEngine();
    }

    class NWEngine extends Engine {
        NWEngine(){
        }

        @Override
        public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) {
            super.onSurfaceChanged(holder, format, width, height);
            getSurfaceHolder().unlockCanvasAndPost(getSurfaceHolder().lockCanvas());
        }

        @Override
        public void onOffsetsChanged(float xOffset, float yOffset, float xStep, float yStep, int xPixels, int yPixels) {
            super.onOffsetsChanged(xOffset, yOffset, xStep, yStep, xPixels, yPixels);
            getSurfaceHolder().unlockCanvasAndPost(getSurfaceHolder().lockCanvas());
        }
    }
}

这是 LogCAT:

3 21:32:36.708: D/AndroidRuntime(22907): Shutting down VM
03-13 21:32:36.718: W/dalvikvm(22907): threadid=1: thread exiting with uncaught exception (group=0x40aa1228)
03-13 21:32:36.748: E/AndroidRuntime(22907): FATAL EXCEPTION: main
03-13 21:32:36.748: E/AndroidRuntime(22907): java.lang.RuntimeException: Unable to instantiate service dev.live.no.wallpaper: java.lang.ClassNotFoundException: dev.live.no.wallpaper
03-13 21:32:36.748: E/AndroidRuntime(22907):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2538)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at android.app.ActivityThread.access$1600(ActivityThread.java:139)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1325)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at android.os.Handler.dispatchMessage(Handler.java:99)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at android.os.Looper.loop(Looper.java:154)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at android.app.ActivityThread.main(ActivityThread.java:4945)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at java.lang.reflect.Method.invokeNative(Native Method)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at java.lang.reflect.Method.invoke(Method.java:511)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at dalvik.system.NativeStart.main(Native Method)
03-13 21:32:36.748: E/AndroidRuntime(22907): Caused by: java.lang.ClassNotFoundException: dev.live.no.wallpaper
03-13 21:32:36.748: E/AndroidRuntime(22907):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-13 21:32:36.748: E/AndroidRuntime(22907):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2535)
03-13 21:32:36.748: E/AndroidRuntime(22907):    ... 10 more

我是安卓新手。我只是想让这个错误消失。
Error…… Unfortunately Application has stopped_
当我预览壁纸或设置壁纸时,它会出现错误。虽然它成功设置了壁纸。

4

0 回答 0