壁纸设置强制关闭
每当我尝试启动动态壁纸设置时,都会遇到强制关闭问题。我那里真的没有任何东西,所以我不确定是什么可能导致问题...这是 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
我认为这是权限拒绝行,但我不知道可能导致它的原因...我需要设置一些隐藏权限吗?这是我的第一个动态壁纸。
谢谢!
I'm having a force close problem whenever I try to launch the settings for my live wallpaper. I don't really have anything there, so I'm not sure what could possibly be causing the problem... Here is the 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
I think it's that permission denial line, but I have no clue what could be causing it... Is there some hidden permission I need to set? This is my first liveWallpaper.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,您需要在 Android 清单文件中设置 SET_WALLPAPER 权限。您可以在
元素中使用以下行;更新:
参考:
< ;uses-permission>
元素。Yes, you need to set the SET_WALLPAPER permission in Android manifest file. You can use the following line inside the
<manifest></manifest>
element;Update:
Reference:
<uses-permission>
element.呃,我发现了问题......事实证明我需要清单中的首选项活动已导出设置为“true”。还有一个小时我就回不来了!
Ugh, I found the problem... It turns out I needed the preference activity in the manifest have exported set to "true". There's an hour I'll never get back!
虽然接受的答案肯定有效,但这不是正确的方法。将导出设置为 true 仅意味着可以在应用程序外部启动该活动。但是,应该这样做的方法是像这样声明活动:
While the accepted answer definitely works, it's not the correct way to do it. Setting export to true just means the activity can be launched outside of your application. However, the way this should be done is to declare the activity like this: