You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Gradle桌面启动器无法检测平台及libGDX项目构建问题求助

Gradle/libGDX项目构建与桌面运行故障排查求助
  • 开发Gradle/libGDX项目,此前可成功构建Web应用,当前版本构建步骤失败,桌面启动器运行也出现问题
  • 项目通过Android Studio编译可正常运行,但构建成功后执行阶段失败
  • 在WSL环境下运行,另一台配置类似的WSL/Android Studio机器测试,结果一致

桌面启动器运行错误

执行./gradlew desktop:run时出现以下错误:

[LWJGL] GLFW_PLATFORM_UNAVAILABLE error
        Description : Failed to detect any supported platform
        Stacktrace  :
                org.lwjgl.glfw.GLFW.glfwInit(GLFW.java:1047)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.initializeGlfw(Lwjgl3Application.java:88)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:138)
                com.mygdx.vdna.DesktopLauncher.main(DesktopLauncher.java:12)
Exception in thread "main" com.badlogic.gdx.utils.GdxRuntimeException: Unable to initialize GLFW
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.initializeGlfw(Lwjgl3Application.java:89)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:138)
        at com.mygdx.vdna.DesktopLauncher.main(DesktopLauncher.java:12)

错误起始位置的DesktopLauncher代码

package com.mygdx.vdna;

import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;

public class DesktopLauncher {
    public static void main (String[] arg) {
        Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
        config.setWindowedMode(800, 480);
        config.useVsync(true);
        config.setForegroundFPS(60);
        new Lwjgl3Application(new com.mygdx.vdna.VGame(), config);
    }
}

Gradle构建错误

执行gradle build时出现以下错误:

WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 33

This Android Gradle plugin (7.2.1) was tested up to compileSdk = 32

This warning can be suppressed by adding
    android.suppressUnsupportedCompileSdk=33
to this project's gradle.properties

The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 33
Checking the license for package Android SDK Build-Tools 33 in /mnt/c/Users/Narthan/AppData/Local/Android/Sdk/licenses
License for package Android SDK Build-Tools 33 accepted.
Preparing "Install Android SDK Build-Tools 33 (revision: 33.0.0)".

FAILURE: Build failed with an exception.

* What went wrong:
'void org.apache.commons.compress.archivers.zip.ZipFile.<init>(java.nio.channels.SeekableByteChannel)'

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s

Android SDK安装错误

尝试通过Android Studio SDK管理器重新安装Android SDK时出现以下错误:

Packages to install: - Android SDK Build-Tools 33 (build-tools;33.0.0)


Preparing "Install Android SDK Build-Tools 33 (revision: 33.0.0)".
Found existing prepared package.
"Install Android SDK Build-Tools 33 (revision: 33.0.0)" ready.
An error occurred during installation: C:\mnt\c\Users\Narthan\AppData\Local\Android\Sdk\.temp\PackageOperation01\unzip.
"Install Android SDK Build-Tools 33 (revision: 33.0.0)" complete.
"Install Android SDK Build-Tools 33 (revision: 33.0.0)" failed.
Failed packages:
- Android SDK Build-Tools 33 (build-tools;33.0.0)

当前状态

  • local.properties文件在Android Studio中显示黄色,路径存在但内容为空
  • 怀疑损坏了重要的Gradle文件,正在学习Gradle项目结构,恳请提供下一步排查建议

内容的提问来源于stack exchange,提问作者ate50eggs

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 15:50:38