跳到内容
CrossFly 是 100% 开源在 GitHub 关注我们
CrossFlyCrossFly
开始使用

本页面由葡萄牙语机器翻译,可能存在错误。葡萄牙语版本为准。

编译错误(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 修复示例

// 之前(无法编译)
import dev.crossfly.sql.*;      // JDBC 已移除
new Toast("Salvo");            // Toast 已移除

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

另请参阅

这个页面有帮助吗?