壁纸设置强制关闭

发布于 2024-10-24 09:06:41 字数 3389 浏览 4 评论 0原文

每当我尝试启动动态壁纸设置时,都会遇到强制关闭问题。我那里真的没有任何东西,所以我不确定是什么可能导致问题...这是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

獨角戲 2024-10-31 09:06:42

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

<uses-permission android:name="android.permission.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;

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

Update:

Reference: <uses-permission> element.

墟烟 2024-10-31 09:06:41

呃,我发现了问题......事实证明我需要清单中的首选项活动已导出设置为“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!

冷…雨湿花 2024-10-31 09:06:41

虽然接受的答案肯定有效,但这不是正确的方法。将导出设置为 true 仅意味着可以在应用程序外部启动该活动。但是,应该这样做的方法是像这样声明活动:

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

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:

    <activity android:name="com.example.SettingsActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
        </intent-filter>
    </activity>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文