# 构建与 Gradle

> app 启动前的失败 —— 依赖、原生库、classname、资源、Web/TeaVM。

Source: https://crossfly.dev/zh/docs/troubleshooting/build-gradle — CrossFly documentation. Full docs as one file: https://crossfly.dev/llms-full.txt

# 构建与 Gradle

app 启动前的失败。格式：**症状 → 原因 → 修复**。

## 依赖无法解析
**原因：** 模块/坐标错误。
**修复：** 检查 `core` 中 CrossFly 的依赖 + `settings.gradle`/`build.gradle` 中的**平台模块**（`lwjgl3`/`android`/`ios`/`web`）。
（[安装](/docs/get-started/installation)）

## 运行时找不到原生库（`crossfly-lib` / SQLite3MC）
**原因：** 该平台的原生模块没有被打包。
**修复：** 引入**正确的 launcher/原生库**；在桌面端，确保 `crossfly-lib` 位于 `java.library.path` 中。（记住：在 **WebGL** 上原生库**不会**被加载。）
（[桌面](/docs/platforms/desktop-lwjgl3) · 第 23 章）

## `:lwjgl3:run` 找不到 `MainWindow`
**原因：** *classname* 没有指向你的类。
**修复：** 配置 `cmdline["classname"]`（在 launcher 中）或重写 `getMainWindow()`。
（[项目结构剖析](/docs/get-started/project-structure)）

## 资源/字体（roboto/fontawesome/material）无法加载
**原因：** 没有打包进模块。
**修复：** 检查 launcher 的资源目录（基础字体在 bootstrap 阶段加载）。

## Web 目标（TeaVM）转译失败
**原因：** 使用了 TeaVM 不支持的 API。
**修复：** **隔离非 web 代码**（放在平台检查/服务抽象的背后）。
（[Web (TeaVM)](/docs/platforms/web-teavm)）

## 另请参阅
- [平台特定问题](/docs/troubleshooting/platform-specific) · [构建与发布](/docs/platforms/building-and-releasing)
