编译xiaozhi-esp32-server-java遇到的报错
我的 Mac 电脑是 Intel 的, M芯片的可能不会报这些错;
1、首先第一个问题就是 org.slf4j 冲突问题, 禁用掉一个就行了。 打开 pom.xml 把阿里这个slf4j-simple给禁用。
<!-- 阿里云ASR --><dependency><groupId>com.alibaba</groupId><artifactId>dashscope-sdk-java</artifactId><version>2.19.1</version><exclusions><exclusion><groupId>org.slf4j</groupId><artifactId>slf4j-simple</artifactId></exclusion></exclusions></dependency>
2、然后就是,vosk的问题 。 看他这个代码,M芯片的苹果电脑,就没问题,我是Intel的啊, 我把他的判断: aarch64 给去掉了
if (osName.contains("mac")) { // && osArch.contains("aarch64")// 如果是 macOS 并且是 ARM 架构(M 系列芯片) 我换成了 x86的System.load(System.getProperty("user.dir") + "/models/libvosk.dylib");logger.info("Vosk library loaded for macOS M-series chip and Intel chip.我改成了Intel的,如果换了M芯片的电脑就要更换一下");} else {logger.info("Not macOS M-series chip, skipping Vosk library load.");}
解决办法,去下载低版本的 libvosk.dylib 下载地址: 点击这里下载 这个是 0.3.42版本的。
这个版本的 libvosk.dylib 不支持新版本加的方法会报错,所以对应的 jar 的版本也需要降, 打开 pom.xml
<!-- Vosk --><dependency><groupId>com.alphacephei</groupId><artifactId>vosk</artifactId><version>0.3.38</version></dependency>
把它的版本号从 0.3.45 改到 0.3.38
搞完这些,就可以运行了。 别忘了搞数据库。
admin 默认账户的密码: 123456
补充, 关于客户端提示: 没有找到该设备的版本信息,请正确配置OTA地址;解决办法:
自己去发个请求:
请求地址: 你的OTA服务地址;
header:
Content-Type : application/json
Device-Id : 你的设备MAC地址
body:
{"flash_size": 16777216, "minimum_free_heap_size": 8318916, "mac_address": "你的设备Mac地址","chip_model_name": "esp32s3", "chip_info": {"model": 9, "cores": 2, "revision": 2, "features": 18},"application": {"name": "xiaozhi", "version": "0.9.9", "compile_time": "Jan 22 2025T20:40:23Z","idf_version": "v5.3.2-dirty","elf_sha256": "22986216df095587c42f8aeb06b239781c68ad8df80321e260556da7fcf5f522"},"partition_table": [{"label": "nvs", "type": 1, "subtype": 2, "address": 36864, "size": 16384},{"label": "otadata", "type": 1, "subtype": 0, "address": 53248, "size": 8192},{"label": "phy_init", "type": 1, "subtype": 1, "address": 61440, "size": 4096},{"label": "model", "type": 1, "subtype": 130, "address": 65536, "size": 983040},{"label": "storage", "type": 1, "subtype": 130, "address": 1048576,"size": 1048576},{"label": "factory", "type": 0, "subtype": 0, "address": 2097152, "size": 4194304},{"label": "ota_0", "type": 0, "subtype": 16, "address": 6291456, "size": 4194304},{"label": "ota_1", "type": 0, "subtype": 17, "address": 10485760,"size": 4194304}],"ota": {"label": "factory"},"board": {"type": "bread-compact-wifi", "ssid": "mzy", "rssi": -58, "channel": 6,"ip": "你的客户端IP,好像不传也没什么用", "mac": "你的MAC地址"}}
请求完后返回: activation 里的 code 就是验证码了,你后台添加就好了。
{"server_time": {"timestamp": 1747884315337,"timeZone": "Asia/Shanghai","timezone_offset": 480},"activation": {"code": "810978","message": "2662r3426b.vicp.fun\n810978","challenge": "f5:ed:88:bd:66:6f"},"firmware": {"version": "0.9.9","url": "http://xiaozhi.server.com:8002/xiaozhi/otaMag/download/NOT_ACTIVATED_FIRMWARE_THIS_IS_A_INVALID_URL"},"websocket": {"url": "wss://2662r3426b.vicp.fun/xiaozhi/v1/"}
}