سؤال

This is my first android project, I use Android Studio 0.5.2 I am trying to build a live wallpaper and found this neat tutorial: http://www.techrepublic.com/blog/software-engineer/a-bare-bones-live-wallpaper-template-for-android/

I followed it and everything seems fine except the registration of the WallpaperService in the manifest.

 <service
        android:enabled="true"
        android:label="Battery Wallpaper"
        android:name=".DemoWallpaperService"
        android:permission="android.permission.BIND_WALLPAPER"
        >

where the name is defined, i get "Cannot resolve symbol '.DemoWallpaperService' "

i tried adding the package name but it didn't help either. I also checked, DemoWallpaperService does import and extend WallpaperService without error

Thank you!

هل كانت مفيدة؟

المحلول

All java files must begin with the package statement, but I can not see it from code you posted in pastebin.

Add to your class' first line:

package <app_package_name>;

And in your project, make sure there is a DemoWallpaperService.java file within the folder.

نصائح أخرى

The directory structure of your java files MUST be :

[project]\[module]\src\main\java\[yourpackage]\[yourclass.java]
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top