- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试使用 libgdx 库在 android 中制作动态壁纸应用程序,但我遇到了问题。每当在动态壁纸选择器中按下设置按钮时,应用程序就会崩溃并显示消息:“不幸的是,动态壁纸选择器已停止”,否则一切正常。
我一直在关注这个例子: How to create android live wallpaper
我尝试在这里寻找解决方案,例如此页面: Live Wallpaper crash when tap on Settings
但没有什么可以解决我的问题 - 我认为它在 xml 文件中的某个地方,但也许将 libgdx 与 livewallpaper 结合存在问题?
我一直在尝试找到解决方案,但找不到,非常感谢您的帮助。
这是我的代码:
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mygdx.game.android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.SET_WALLPAPER"></uses-permission>
<uses-feature android:required="true" android:name="android.software.live_wallpaper"> </uses-feature>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity android:name="com.mygdx.game.android.AndroidLauncher"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.mygdx.game.android.LivewallpaperSettings"
android:label="Livewallpaper Settings"
android:theme="@android:style/Theme.Light.WallpaperSettings"
android:exported="true">
</activity>
<service
android:name="com.mygdx.game.android.LiveWallpaper"
android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:permission="android.permission.BIND_WALLPAPER">
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/wallpaper" />
</service>
</application>
</manifest>
LivewallpaperSettings.java
package com.mygdx.game.android;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceActivity;
public class LivewallpaperSettings extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
@Override
protected void onCreate(Bundle icicle)
{
super.onCreate(icicle);
getPreferenceManager().setSharedPreferencesName(LiveWallpaper.SHARED_PREFS_NAME);
addPreferencesFromResource(R.xml.settings);
getPreferenceManager().getSharedPreferences()
.registerOnSharedPreferenceChangeListener(this);
}
@Override
protected void onResume()
{
super.onResume();
}
@Override
protected void onDestroy()
{
getPreferenceManager().getSharedPreferences()
.unregisterOnSharedPreferenceChangeListener(this);
super.onDestroy();
}
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key)
{
}
}
wallpaper.xml
<?xml version="1.0" encoding="UTF-8"?>
<wallpaper
xmlns:android="http://schemas.android.com/apk/res/android"
android:thumbnail="@drawable/ic_launcher"
android:settingsActivity="lwp.example.android.LivewallpaperSettings"/>
settings.xml
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="settings"
android:key="settings">
<ListPreference
android:key="livewallpaper_testpattern"
android:title="title 1"
android:summary="do 1"
android:entries="@array/livewallpaper_testpattern_names"
android:entryValues="@array/livewallpaper_testpattern_prefix"/>
<CheckBoxPreference android:key="livewallpaper_movement"
android:title="title 2"
android:summary="do 2"
android:summaryOn="Moving test pattern"
android:summaryOff="Still test pattern"/>
</PreferenceScreen>
这是我收到错误时的 logcat:
11-14 15:40:04.254: W/GL2JNIView(1654): creating OpenGL ES 2.0 context
11-14 15:40:04.265: I/AndroidGraphics(1654): OGL renderer: Adreno (TM) 320
11-14 15:40:04.265: I/AndroidGraphics(1654): OGL vendor: Qualcomm
11-14 15:40:04.265: I/AndroidGraphics(1654): OGL version: OpenGL ES 3.0 V@84.0 AU@05.00.02.006.020 (CL@)
11-14 15:40:04.265: I/AndroidGraphics(1654): OGL extensions: GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_sync GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_texture_sRGB_decode GL_EXT_multisampled_render_to_texture GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_disjoint_timer_query
11-14 15:40:04.265: W/Adreno-EGL(1654): <qeglDrvAPI_eglGetConfigAttrib:632>: EGL_BAD_ATTRIBUTE
11-14 15:40:04.265: W/Adreno-EGL(1654): <qeglDrvAPI_eglGetConfigAttrib:632>: EGL_BAD_ATTRIBUTE
11-14 15:40:04.265: I/AndroidGraphics(1654): framebuffer: (5, 6, 5, 0)
11-14 15:40:04.265: I/AndroidGraphics(1654): depthbuffer: (16)
11-14 15:40:04.265: I/AndroidGraphics(1654): stencilbuffer: (0)
11-14 15:40:04.265: I/AndroidGraphics(1654): samples: (0)
11-14 15:40:04.265: I/AndroidGraphics(1654): coverage sampling: (false)
11-14 15:40:04.333: I/Running LiquidFun version(1654): LiquidFun 1.1.0
11-14 15:40:04.333: I/720.0(1654): 1280.0
11-14 15:40:04.429: I/AndroidInput(1654): sensor listener setup
11-14 15:40:09.043: I/WallpaperService(1654): service destroyed
11-14 15:40:09.043: I/WallpaperService(1654): engine paused
11-14 15:40:09.217: E/Surface(1654): queueBuffer: error queuing buffer to SurfaceTexture, -19
11-14 15:40:09.218: W/Adreno-EGLSUB(1654): <SwapBuffers:1344>: failed to queueBuffer
11-14 15:40:09.218: W/Adreno-EGL(1654): <qeglDrvAPI_eglSwapBuffers:3798>: EGL_BAD_SURFACE
11-14 15:40:09.220: I/AndroidInput(1654): sensor listener tear down
11-14 15:40:09.236: E/Surface(1654): queueBuffer: error queuing buffer to SurfaceTexture, -19
11-14 15:40:09.236: W/Adreno-EGLSUB(1654): <SwapBuffers:1344>: failed to queueBuffer
11-14 15:40:09.236: W/Adreno-EGL(1654): <qeglDrvAPI_eglSwapBuffers:3798>: EGL_BAD_SURFACE
11-14 15:40:09.244: I/WallpaperService(1654): engine surface destroyed
最佳答案
我发现了问题,我错误地引用了“LivewallpaperSettings.java”“wallpaper.xml”文件中的类:
相反:android:settingsActivity="lwp.example.android.LivewallpaperSettings
应该是:android:settingsActivity="com.mygdx.game.android.LivewallpaperSettings"
我使用了另一个项目作为引用并将其复制,但没有将其更改为正确的路径。抱歉..浪费了我和其他人的时间:/
感谢您的帮助。
关于java - android 动态壁纸设置按钮单击会导致错误 - 不幸的是,动态壁纸选择器已停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33708957/
我已经使用 vue-cli 两个星期了,直到今天一切正常。我在本地建立这个项目。 https://drive.google.com/open?id=0BwGw1zyyKjW7S3RYWXRaX24tQ
您好,我正在尝试使用 python 库 pytesseract 从图像中提取文本。请找到代码: from PIL import Image from pytesseract import image_
我的错误 /usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference
我已经训练了一个模型,我正在尝试使用 predict函数但它返回以下错误。 Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]])
根据Microsoft DataConnectors的信息我想通过 this ODBC driver 创建一个从 PowerBi 到 PostgreSQL 的连接器使用直接查询。我重用了 Micros
我已经为 SoundManagement 创建了一个包,其中有一个扩展 MediaPlayer 的类。我希望全局控制这个变量。这是我的代码: package soundmanagement; impo
我在Heroku上部署了一个应用程序。我正在使用免费服务。 我经常收到以下错误消息。 PG::Error: ERROR: out of memory 如果刷新浏览器,就可以了。但是随后,它又随机发生
我正在运行 LAMP 服务器,这个 .htaccess 给我一个 500 错误。其作用是过滤关键字并重定向到相应的域名。 Options +FollowSymLinks RewriteEngine
我有两个驱动器 A 和 B。使用 python 脚本,我在“A”驱动器中创建一些文件,并运行 powerscript,该脚本以 1 秒的间隔将驱动器 A 中的所有文件复制到驱动器 B。 我在 powe
下面的函数一直返回这个错误信息。我认为可能是 double_precision 字段类型导致了这种情况,我尝试使用 CAST,但要么不是这样,要么我没有做对...帮助? 这是错误: ERROR: i
这个问题已经有答案了: Syntax error due to using a reserved word as a table or column name in MySQL (1 个回答) 已关闭
我的数据库有这个小问题。 我创建了一个表“articoli”,其中包含商品的品牌、型号和价格。 每篇文章都由一个 id (ID_ARTICOLO)` 定义,它是一个自动递增字段。 好吧,现在当我尝试插
我是新来的。我目前正在 DeVry 在线学习中级 C++ 编程。我们正在使用 C++ Primer Plus 这本书,到目前为止我一直做得很好。我的老师最近向我们扔了一个曲线球。我目前的任务是这样的:
这个问题在这里已经有了答案: What is an undefined reference/unresolved external symbol error and how do I fix it?
我的网站中有一段代码有问题;此错误仅发生在 Internet Explorer 7 中。 我没有在这里发布我所有的 HTML/CSS 标记,而是发布了网站的一个版本 here . 如您所见,我在列中有
如果尝试在 USB 设备上构建 node.js 应用程序时在我的树莓派上使用 npm 时遇到一些问题。 package.json 看起来像这样: { "name" : "node-todo",
在 Python 中,您有 None单例,在某些情况下表现得很奇怪: >>> a = None >>> type(a) >>> isinstance(a,None) Traceback (most
这是我的 build.gradle (Module:app) 文件: apply plugin: 'com.android.application' android { compileSdkV
我是 android 的新手,我的项目刚才编译和运行正常,但在我尝试实现抽屉导航后,它给了我这个错误 FAILURE: Build failed with an exception. What wen
谁能解释一下?我想我正在做一些非常愚蠢的事情,并且急切地等待着启蒙。 我得到这个输出: phpversion() == 7.2.25-1+0~20191128.32+debian8~1.gbp108
我是一名优秀的程序员,十分优秀!