- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试将我的游戏升级到 libGDX 1.9.5。该游戏在桌面上运行良好,但当我尝试构建 HTML 版本时,出现以下错误:
Configuration on demand is an incubating feature.
:core:compileJava UP-TO-DATE
:core:processResources UP-TO-DATE
:core:classes UP-TO-DATE
:core:jar UP-TO-DATE
:html:compileJava UP-TO-DATE
:html:processResources UP-TO-DATE
:html:classes UP-TO-DATE
:html:addSource
:html:compileGwt
Loading inherited module 'tech.otter.merchant.GdxDefinition'
Loading inherited module 'com.badlogic.gdx.backends.gdx_backends_gwt'
Loading inherited module 'com.google.gwt.user.User'
Loading inherited module 'com.google.gwt.media.Media'
Loading inherited module 'com.google.gwt.user.UI'
Loading inherited module 'com.google.gwt.uibinder.UiBinder'
[ERROR] Line 20: Unexpected element 'resource'
[ERROR] Failure while parsing XML
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.util.xml.DefaultSchema.onUnexpectedElement(DefaultSchema.java:86)
从历史上看,使用 GWT 时对我来说最大的挑战是 VisUI 和 gdx-kiwi,但我已经访问了他们的维基并在我的 gradle 文件中更新了他们的版本,如下所示:
/build.gradle
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
classpath 'com.android.tools.build:gradle:2.2.0'
classpath "com.badlogicgames.gdx:gdx-tools:1.9.4"
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.1'
ext {
appName = "merchant"
gdxVersion = '1.9.5'
roboVMVersion = '2.2.0'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
kiwiVersion = '1.8.1.9.4'
visVersion = '1.3.0-SNAPSHOT'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
compile "com.github.czyzby:gdx-kiwi:$kiwiVersion"
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
}
}
project(":html") {
apply plugin: "gwt"
apply plugin: "war"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion:sources"
compile "com.github.czyzby:gdx-kiwi:$kiwiVersion:sources"
compile "com.kotcrab.vis:vis-ui:$visVersion:sources"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
compile "com.github.czyzby:gdx-kiwi:$kiwiVersion"
compile "com.kotcrab.vis:vis-ui:$visVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
html/build.gradle
apply plugin: "java"
apply plugin: "jetty"
gwt {
gwtVersion='2.6.1' // Should match the gwt version used for building the gwt backend
maxHeapSize="1G" // Default 256m is not enough for gwt compiler. GWT is HUNGRY
minHeapSize="1G"
src = files(file("src/")) // Needs to be in front of "modules" below.
modules 'tech.otter.merchant.GdxDefinition'
devModules 'tech.otter.merchant.GdxDefinitionSuperdev'
project.webAppDirName = 'webapp'
compiler {
strict = true;
enableClosureCompiler = true;
disableCastChecking = true;
}
}
task draftRun(type: JettyRunWar) {
dependsOn draftWar
dependsOn.remove('war')
webApp=draftWar.archivePath
daemon=true
}
task superDev(type: de.richsource.gradle.plugins.gwt.GwtSuperDev) {
dependsOn draftRun
doFirst {
gwt.modules = gwt.devModules
}
}
task dist(dependsOn: [clean, compileGwt]) {
doLast {
file("build/dist").mkdirs()
copy {
from "build/gwt/out"
into "build/dist"
}
copy {
from "webapp"
into "build/dist"
}
copy {
from "war"
into "build/dist"
}
delete "../../madigan.github.io/merchant/"
copy {
from "build/dist"
into "../../madigan.github.io/merchant/"
}
doGit
}
}
task doGit(type: Exec) {
commandLine 'git', '-C', '../../madigan.github.io', 'add', '.'
commandLine 'git', '-C', '../../madigan.github.io', 'commit', '-m', '"Distribution."'
commandLine 'git', '-C', '../../madigan.github.io', 'push'
}
draftWar {
from "war"
}
task addSource << {
sourceSets.main.compileClasspath += files(project(':core').sourceSets.main.allJava.srcDirs)
}
tasks.compileGwt.dependsOn(addSource)
tasks.draftCompileGwt.dependsOn(addSource)
sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = [ "src/" ]
eclipse.project {
name = appName + "-html"
}
如有任何关于如何解决此错误的建议或提示,我们将不胜感激。
[编辑]
我仔细阅读了发行说明,它说我应该将 GWT 版本更改为 2.8.0。即使我这样做,我仍然会收到以下错误:
Configuration on demand is an incubating feature.
:core:compileJava UP-TO-DATE
:core:processResources UP-TO-DATE
:core:classes UP-TO-DATE
:core:jar UP-TO-DATE
:html:compileJava UP-TO-DATE
:html:processResources UP-TO-DATE
:html:classes UP-TO-DATE
:html:addSource
:html:compileGwt
Unknown argument: -XenableClosureCompiler
Google Web Toolkit 2.8.0
Compiler [-logLevel (ERROR|WARN|INFO|TRACE|DEBUG|SPAM|ALL)] [-workDir dir] [-X[no]closureFormattedOutput] [-[no]compileReport] [-X[no]checkCasts] [-X[no]classMetadata] [-[no]draftCompile] [-[no]checkAssertions] [-XfragmentCount numFragments] [-XfragmentMerge numFragments] [-gen dir] [-[no]generateJsInteropExports] [-XmethodNameDisplayMode (NONE|ONLY_METHOD_NAME|ABBREVIATED|FULL)] [-Xnamespace (NONE|PACKAGE)] [-optimize level] [-[no]saveSource] [-setProperty name=value,value...] [-style (DETAILED|OBFUSCATED|PRETTY)] [-[no]failOnError] [-[no]validateOnly] [-sourceLevel [auto, 1.8]] [-localWorkers count] [-[no]incremental] [-war dir] [-deploy dir] [-extra dir] [-saveSourceOutput dir] module[s]
where
-logLevel The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM or ALL (defaults to INFO)
-workDir The compiler's working directory for internal use (must be writeable; defaults to a system temp dir)
-X[no]closureFormattedOutput EXPERIMENTAL: Enables Javascript output suitable for post-compilation by Closure Compiler (defaults to OFF)
-[no]compileReport Compile a report that tells the "Story of Your Compile". (defaults to OFF)
-X[no]checkCasts EXPERIMENTAL: DEPRECATED: use jre.checks.checkLevel instead. (defaults to OFF)
-X[no]classMetadata EXPERIMENTAL: Include metadata for some java.lang.Class methods (e.g. getName()). (defaults to ON)
-[no]draftCompile Compile quickly with minimal optimizations. (defaults to OFF)
-[no]checkAssertions Include assert statements in compiled output. (defaults to OFF)
-XfragmentCount EXPERIMENTAL: Limits of number of fragments using a code splitter that merges split points.
-XfragmentMerge DEPRECATED (use -XfragmentCount instead): Enables Fragment merging code splitter.
-gen Debugging: causes normally-transient generated types to be saved in the specified directory
-[no]generateJsInteropExports Generate exports for JsInterop purposes (defaults to OFF)
-XmethodNameDisplayMode EXPERIMENTAL: Specifies method display name mode for chrome devtools: NONE, ONLY_METHOD_NAME, ABBREVIATED or FULL (defaults to NONE)
-Xnamespace Puts most JavaScript globals into namespaces. Default: PACKAGE for -draftCompile, otherwise NONE
-optimize Sets the optimization level used by the compiler. 0=none 9=maximum.
-[no]saveSource Enables saving source code needed by debuggers. Also see -debugDir. (defaults to OFF)
-setProperty Set the values of a property in the form of propertyName=value1[,value2...].
-style Script output style: DETAILED, OBFUSCATED or PRETTY (defaults to OBFUSCATED)
-[no]failOnError Fail compilation if any input file contains an error. (defaults to ON)
-[no]validateOnly Validate all source code, but do not compile. (defaults to OFF)
-sourceLevel Specifies Java source level (defaults to 1.8)
-localWorkers The number of local workers to use when compiling permutations
-[no]incremental Compiles faster by reusing data from the previous compile. (defaults to OFF)
-war The directory into which deployable output files will be written (defaults to 'war')
-deploy The directory into which deployable but not servable output files will be written (defaults to 'WEB-INF/deploy' under the -war directory/jar, and may be the same as the -extra directory/jar)
-extra The directory into which extra files, not intended for deployment, will be written
-saveSourceOutput Overrides where source files useful to debuggers will be written. Default: saved with extras.
and
module[s] Specifies the name(s) of the module(s) to compile
:html:compileGwt FAILED
[编辑 #2]
现在根据@Colin Altworth 的回答删除了标志,我收到以下特定于 vis-ui 的错误(再次更新为使用 libGDX 1.9.5 的推荐版本):
:html:compileGwt
Compiling module tech.otter.merchant.GdxDefinition
Tracing compile failure path for type 'com.kotcrab.vis.ui.util.async.AsyncTask'
[ERROR] Errors in 'jar:file:/home/john/.gradle/caches/modules-2/files-2.1/com.kotcrab.vis/vis-ui/1.3.0-SNAPSHOT/e5f8abbdc3524212158f65d63c9a28d226795f97/vis-ui-1.3.0-SNAPSHOT-sources.jar!/com/kotcrab/vis/ui/util/async/AsyncTask.java'
[ERROR] Line 46: The constructor Thread(new Runnable(){}, String) is undefined
[ERROR] Line 51: The method start() is undefined for the type Thread
[ERROR] Aborting compile due to errors in some input files
:html:compileGwt FAILED
FAILURE: Build failed with an exception.
[编辑 #3]
原来问题的其余部分是 VisUI 中的错误 - 最新更新尝试使用 GWT 不支持的 Thread 类。
最佳答案
Unknown argument: -XenableClosureCompiler
从您的 gradle GWT 构建中删除关闭标志:
gwt {
gwtVersion='2.6.1' // Should match the gwt version used for building the gwt backend
maxHeapSize="1G" // Default 256m is not enough for gwt compiler. GWT is HUNGRY
minHeapSize="1G"
src = files(file("src/")) // Needs to be in front of "modules" below.
modules 'tech.otter.merchant.GdxDefinition'
devModules 'tech.otter.merchant.GdxDefinitionSuperdev'
project.webAppDirName = 'webapp'
compiler {
strict = true;
enableClosureCompiler = true;//<------------------------REMOVE THIS
disableCastChecking = true;
}
}
GWT 不再支持这个实验性标志。
关于java - 如何将 libGDX GWT 游戏转换为 1.9.5 版?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41232882/
libGDX Array类的javadoc说:一个可调整大小,有序或无序的对象数组。如果是无序的,则此类在删除元素时避免了内存复制(最后一个元素移动到删除的元素的位置)。 去除元素的改进是此类的唯一优
声音API似乎缺少指示声音播放完毕的功能。还有其他方法可以确定声音是否完成了吗? 最佳答案 据我所知,OpenAL和Android的底层声音后端甚至都没有内部跟踪信息,尽管Music API具有的is
我在应用程序启动时执行了此代码 val resolver = InternalFileHandleResolver() asset.setLoader(FreeTypeFontGenerator::c
我想要获取点 1 和点 2 之间相对于中心点的角度。如何使用 Vector2 执行此操作? Vector2 center = new Vector2((float)Gdx.graphics.getWi
我正在尝试渲染平滑的可缩放位图字体。检查后question answers之一提到使用距离场字体。 我正在按照 LibGDX wiki article 中提到的方式进行操作关于距离场字体。但是我无法让
我已经寻找答案大约 2 个小时了,但还没有找到我想要的答案。我的问题是,是否可以以及如何绘制圆形纹理,以便在圆形之外,纹理将是透明的,这甚至可能吗? 提前致谢!到目前为止,该网站提供了很大的帮助! 最
我用 libgdx 开始了一个项目,我有一个 GameStateManager 用于我的 GameStates 菜单和播放。 如果我运行该项目,它会显示菜单,然后我可以单击一个按钮来打开 Play G
我正在使用 libgdx。我需要缩放和定位文本。假设我想绘制 30 像素高的 X,并且我希望它位于屏幕中间。我想在不同的位置和不同的比例画更多的人。 有什么办法可以实现吗?我在任何地方都找不到解决方案
我正在 Libgdx 中制作纹理打包机,其中如果我使用打包机 2,048 * 2,048 的大小,只制作一个大小为 3.14 Mb 的打包机图像,如果我使用打包机的大小 1,024 * 1,024 那
我在每一帧中都进行了大量的三角函数计算。 Java 的 Math 函数是否比 Libgdx 的 MathUtils 更快? 或者我可以使用任何其他比这两个都更快的库吗? 最佳答案 com.badlog
你好,对于 LibGDX 来说有点新,目前在 pc 上的全屏模式存在问题,我想要做的是每当有人按下一个键时将我的游戏设置为全屏,而当我在 main 方法中输入一些东西时,这不会做任何事情桌面启动器.j
几年前我开始开发我的游戏,中间有很大的停顿。那时没有 gradle,只有简单的 java 安装应用程序。如何找到所使用的 LibGDX 版本? 最佳答案 干得好: Gdx.app.log("Gdx v
我正在尝试使用 libGDX 实现一个简单的动画,但目前我遇到了一件事。假设我有一堆 Sprite 需要一些时间才能完成。例如,大约 30 个 Sprite 像这个链接:https://github.
如何在游戏过程中更改窗口标题?我找不到任何方法。例如,我想在标题栏中显示我得了多少分。 最佳答案 尝试这个 : Gdx.graphics.setTitle(""+yourScore); 祝你好运 !
我正在使用 LibGdx 中的声音接口(interface)来播放 mp3 音频文件。 And when choose to loop playing the sound more than one
所以我在 LibGDX 中制作游戏,我使用 AssetManager 加载我的所有 Assets 。 我只是不确定哪种是正确的使用方法。 目前我正在第一个屏幕之前加载所有游戏 Assets 。 然后我
我一直在寻找来自 libgdx SVN 的 skinpacker,但没有成功。 然后我知道它不再存在。所以,问题是如何创建一个 skin.json 文件以在我的 libgdx 项目中使用。你知道有什么
我正在制作连点类型的游戏,我必须在屏幕上触摸的位置画一条线,所以我使用矢量来存储我触摸的各个点。 我用过 if(Gdx.input.isTouched()) { touchpos.set(Gd
我查看了测试项目中的默认皮肤文件。 我不明白为什么 uiskin.png 里面有字体图片。 uiskin.atlas 文件还包含拆分字段,我不明白为什么需要它以及如何使用它。 我在哪里可以找到所有事情
我到处搜索,但没有引用。 我想用this着色器从 shadertoy 到我的 libgdx 项目,所以我尝试首先从以下位置导入简单着色器:https://www.shadertoy.com/view/
我是一名优秀的程序员,十分优秀!