Skip to content

Commit

Permalink
修复BUG,更新README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
EaniaHuui committed Apr 25, 2022
1 parent 2d47a66 commit d130fed
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 7 deletions.
45 changes: 42 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,49 @@

作为一个Android开发者,在开发过程中经常会用到ADB命令,每次进行手敲都觉得麻烦得很,尤其是有些命令忘记了,还得去查,浪费时间,影响效率,于是用Flutter把一些常用的ADB命令封装成一个应用。

### 简介
主要对一些常用ADB命令封装成一个应用,方便在进行Android开发时进行调试,目前在Windows和Mac OS可以运行,Linux上待验证,支持一些常用ADB命令以及文件管理,并且支持拖拽文件进行文件传输和安装APK。
## 简介
通过执行ADB命令来操控Android设备,实现一些常用的功能,方便在进行Android开发时进行调试,目前在Windows和Mac OS可以运行,Linux上待验证,支持一些常用ADB命令以及文件管理,并且支持拖拽文件进行文件传输和安装APK,以及支持查看Log功能。

[下载试用](https://github.com/EaniaHuui/android_tool/releases)

### 演示
![alt screenshot1](https://github.com/EaniaHuui/android_tool/blob/main/screenshot/screenshot1.gif)
![alt screenshot2](https://github.com/EaniaHuui/android_tool/blob/main/screenshot/screenshot2.gif)
![alt screenshot2](https://github.com/EaniaHuui/android_tool/blob/main/screenshot/screenshot2.gif)

## 实现

Flutter开发桌面端应用需要开启相关平台的配置,如下:
```
// 开启支持Windows平台开发(Flutter 2.10版本以上已经默认启用)
flutter config --enable-windows-desktop
// 开启支持Mac平台开发
flutter config --enable-macos-desktop
// 开启支持Linux平台开发
flutter config --enable-linux-desktop
```

### 使用的插件

1. ``provider``:实现状态管理
2. ``process_run``:用于执行ADB命令
3. ``desktop_drop``:实现拖动文件到应用,并且支持多个文件,在此项目中用于从电脑中传输文件到Android设备中,以及进行安装APK
4. ``file_selector``:用于管理文件和与文件对话框的交互,可以方便快捷的弹出文件或文件夹选择对话框
5. ``shared_preferences``:数据的持久化存储
6. ``path_provider``:用于获取系统中的一些目录的路径
7. ``dio``:网络请求,当前项目中主要用来下载ADB工具包
8. ``archive``:解压缩插件,当前项目中主要用来在Windows平台上解压zip文件
9. ``event_bus``:消息传递,主要用于传递一些数据,更新其他Widget
10. ``substring_highlight``:用于实现搜索关键字高亮显示
11. ``flutter_list_view``:用于实现ListView的滚动到指定Item的位置



感兴趣的小伙伴可以点击下方链接下载试用。
对于代码逻辑感兴趣也可直接看源码。



## 上链接
GitHub地址:[android_tool](https://github.com/EaniaHuui/android_tool)
下载试用:[release](https://github.com/EaniaHuui/android_tool/releases)

9 changes: 6 additions & 3 deletions lib/page/android_log/android_log_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class AndroidLogViewModel extends BaseViewModel {
this.deviceId,
this.packageName,
) : super(context) {
App().getAdbPath().then((value) => adbPath = value);
App().eventBus.on<DeviceIdEvent>().listen((event) {
deviceId = event.deviceId;
});
Expand Down Expand Up @@ -79,17 +80,19 @@ class AndroidLogViewModel extends BaseViewModel {

void init() async {
pid = await getPid();
exec("adb", ["-s", deviceId, "logcat", "-c"]);
execAdb(["-s", deviceId, "logcat", "-c"]);
listenerLog();
}

void listenerLog() {
String level = filterLevelViewModel.selectValue?.value ?? "";
shell.run('adb -s $deviceId logcat \"$level\"', onProcess: (process) {
execAdb(["-s", deviceId, "logcat", "$level"], onProcess: (process) {
var outLine = process.outLines;
outLine.listen((line) {
if ((isFilterPackage ? line.contains(pid) : true) &&
(filterContent.isNotEmpty ? line.toLowerCase().contains(filterContent.toLowerCase()) : true)) {
(filterContent.isNotEmpty
? line.toLowerCase().contains(filterContent.toLowerCase())
: true)) {
logList.add(line);
notifyListeners();
if (isShowLast) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
version: 1.0.1+1

environment:
sdk: ">=2.16.1 <3.0.0"
Expand Down

0 comments on commit d130fed

Please sign in to comment.