# 编译错误（2026 年被移除/重命名的 API）

> cannot find symbol / package does not exist —— 从旧 API 到当前 API 的修复对照表。

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

# 编译错误（2026 现代化）

2026 现代化之后最常见的一类问题：由于使用了**被移除或重命名**的 API 而导致的 **`cannot find symbol`** / **`package does not exist`**。格式：**症状 → 原因 → 修复**。

## 修复对照表：旧 API → 当前 API
| 无法编译（旧） | 修复（当前） |
|---|---|
| `Settings`（配置/状态） | `Device` / `DeviceConfig` / `LocaleFormats` / `Screen` |
| `Settings.appSettings` / `appSecretKey` | SQLite 或 `Device.homeFolder` 中的文件 |
| `Toast` / `ToolTip` | `Hint` |
| `Chart` / `Series` / `LineChart` / `PieChart` / `Velocimeter` | `ChartView`（+ `ChartType`） |
| `Rect` | `Rectangle` |
| `ScrollPosition` | `ScrollIndicator` |
| `Color` 类 / `ColorWheel` | `UIConstants` 中的常量 + `ColorUtils` |
| `Transition` 类 | 嵌套枚举 `UIConstants.Transition` |
| `DefaultValues` | `DeviceConfig` |
| `import dev.crossfly.sql.*`（JDBC：`Connection`/`Statement`/`ResultSet`） | `import dev.crossfly.sqlite.*`（`SqliteDb`/`SqliteStmt`/`SqliteCursor`） |
| Bluetooth JSR-82（`DiscoveryAgent`/`RemoteDevice`） | BLE/GATT（`BluetoothManager`…） |
| `phone` 包 | `device` |
| `anim` / `item` 包 | `animation` / `listitem` |

## 被移除且无直接替代的
`Grid`、`Tree`/`Node`/`TreeModel`、`TopMenu`、`Accordion`、`Spacer`、`Velocimeter`、**PDF**、**ESC/POS**、**Barcode**（现改为通过摄像头）、**打印机**。如果你的代码用到了其中之一，则需要重新设计架构（例如：`Grid` → `GridLayout`；`Spacer` → `Gap`/分数；barcode → `CameraBarcode`/`BarcodePicker`）。

## import 修复示例
```java
// 之前（无法编译）
import dev.crossfly.sql.*;      // JDBC 已移除
new Toast("Salvo");            // Toast 已移除

// 之后
import dev.crossfly.sqlite.*;   // 原生 API
Hint.show("Salvo", 2000);            // Hint
```

## 另请参阅
- 按来源分类的指南：[从 TotalCross 迁移](/docs/migrate/from-totalcross) · 重命名：[术语表（reference）](/docs/reference/glossary)
