壁纸设置强制关闭

时间:2011-03-17 09:22:13

标签: android settings live-wallpaper

每当我尝试启动动态壁纸的设置时,我都会遇到强制关闭问题。我真的没有任何东西,所以我不确定可能导致问题的原因......这是logCat

03-17 02:13:55.262: ERROR/AndroidRuntime(12429): FATAL EXCEPTION: main
03-17 02:13:55.262: ERROR/AndroidRuntime(12429): java.lang.IllegalStateException: Could not execute method of the activity
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.view.View$1.onClick(View.java:2072)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.view.View.performClick(View.java:2408)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.view.View$PerformClick.run(View.java:8818)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.os.Handler.handleCallback(Handler.java:587)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.os.Handler.dispatchMessage(Handler.java:92)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.os.Looper.loop(Looper.java:143)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.app.ActivityThread.main(ActivityThread.java:4701)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at java.lang.reflect.Method.invokeNative(Native Method)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at java.lang.reflect.Method.invoke(Method.java:521)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at dalvik.system.NativeStart.main(Native Method)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429): Caused by: java.lang.reflect.InvocationTargetException
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at com.android.wallpaper.livepicker.LiveWallpaperPreview.configureLiveWallpaper(LiveWallpaperPreview.java:113)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at java.lang.reflect.Method.invokeNative(Native Method)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at java.lang.reflect.Method.invoke(Method.java:521)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.view.View$1.onClick(View.java:2067)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     ... 11 more
03-17 02:13:55.262: ERROR/AndroidRuntime(12429): Caused by: java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.SSTSoft.BallInABox/.BallInABoxSettings (has extras) } from ProcessRecord{45b9eb18 12429:com.android.wallpaper.livepicker/10050} (pid=12429, uid=10050) requires null
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.os.Parcel.readException(Parcel.java:1247)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.os.Parcel.readException(Parcel.java:1235)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1298)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.app.Activity.startActivityForResult(Activity.java:2817)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     at android.app.Activity.startActivity(Activity.java:2923)
03-17 02:13:55.262: ERROR/AndroidRuntime(12429):     ... 15 more

我认为这是权限拒绝行,但我不知道是什么原因导致它...我需要设置一些隐藏的权限吗?这是我的第一张liveWallpaper。

谢谢!

3 个答案:

答案 0 :(得分:15)

呃,我发现了问题......事实证明我需要清单中的首选项活动已将导出设置为“true”。有一个小时我永远不会回来!

答案 1 :(得分:7)

虽然接受的答案肯定有效,但这不是正确的方法。将export设置为true只表示可以在应用程序外部启动活动。但是,应该这样做的方式是声明这样的活动:

    <activity android:name="com.example.SettingsActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
        </intent-filter>
    </activity>

答案 2 :(得分:1)

是的,您需要在Android清单文件中设置SET_WALLPAPER权限。您可以在<manifest></manifest>元素中使用以下行;

<uses-permission android:name="android.permission.SET_WALLPAPER" />

<强>更新

参考:<uses-permission> element