前提准备
- 大神开发的android端SerialPort库的git地址是:
https://github.com/kongqw/AndroidSerialPort
- README.md中有关于API配置的说明
第一步:Add the JitPack repository to your build file
- Add it in your root build.gradle at the end of repositories:
- 按照上面提示定位到项目的build.gradle文件,位置如下
- 但是如果这样配置以后会报错,报错信息为:
Caused by: org.gradle.api.InvalidUserCodeException: Build was configured to prefer settings reposito
- 根据最新Android项目依赖结构这篇博客,得知Android新版本项目依赖文件变为setting.gradle文件,位置如下:
- 添加依赖后,代码如下:
第二步:Add the dependency
- 定位到app下的build.gradle文件,位置如下
- 添加dependencies后,代码如下:
串口操作
- git主页后面有各种方法介绍