while (run) { sleep(100); let user; let activityName = currentActivity(); if (activityName == "com.ss.android.ugc.aweme.live.LivePlayActivity") { let texts = id("text").visibleToUser(true).find(); if (!texts.empty()) { let text = texts[texts.length - 1].text(); let arr = text.split(" "); if (arr[arr.length - 1] == "来了") { if (arr[arr.length - 2] != user) { user = arr[arr.length - 2]; id("edit_btn_audience") .visibleToUser(true) .findOne() .click(); sleep(500); setText("欢迎小可爱 " + user + " 来到直播间"); sleep(100); id("lq").visibleToUser(true).findOne().click(); console.log("发送评论"); sleep(100); } } } } else { run = false; toast("脚本停止,未定义的页面:" + activityName); } }
终端执行:
sudo killall -STOP -c usbd
const bool inProduction = const bool.fromEnvironment("dart.vm.product");
Release环境时,inProduction为true,为生产环境;当App运行在Debug和Profile环境时,inProduction为false,为开发环境。
Debug
Debug模式可以在真机和模拟器上同时运行:会打开所有的断言,包括debugging信息、debugger aids(比如observatory)和服务扩展。优化了快速develop/run循环,但是没有优化执行速度、二进制大小和部署。命令flutter run就是以这种模式运行的,通过sky/tools/gn --android或者sky/tools/gn --ios来build。有时候也被叫做“checked模式”或者“slow模式”。
Release
Release模式只能在真机上运行,不能在模拟器上运行:会关闭所有断言和debugging信息,关闭所有debugger工具。优化了快速启动、快速执行和减小包体积。禁用所有的debugging aids和服务扩展。这个模式是为了部署给最终的用户使用。命令flutter run --release就是以这种模式运行的,通过sky/tools/gn --android --runtime-mode=release或者sky/tools/gn --ios --runtime-mode=release来build。
Profile
Profile模式只能在真机上运行,不能在模拟器上运行:基本和Release模式一致,除了启用了服务扩展和tracing,以及一些为了最低限度支持tracing运行的东西(比如可以连接observatory到进程)。命令flutter run --profile就是以这种模式运行的,通过sky/tools/gn --android --runtime-mode=profile或者sky/tools/gn --ios --runtime-mode=profile```来build。因为模拟器不能代表真实场景,所以不能在模拟器上运行。
Test
headless test模式只能在桌面上运行:基本和Debug模式一致,除了是headless的而且你能在桌面运行。命令flutter test就是以这种模式运行的,通过sky/tools/gn来build。
在我们实际开发中,应该用到上面所说的四种模式又各自分为两种:一种是未优化的模式,供开发人员调试使用;一种是优化过的模式,供最终的开发人员使用。默认情况下是未优化模式,如果要开启优化模式,build的时候在命令行后面添加--unoptimized参数。
Android Studio Git Push报错
fatal: could not read Password for 'https://Kxmrg@gitee.com': Device not configured
AndroidStudio -> Settings -> Version Control -> Git -> 勾选 Use credential helper 选项解决
终端执行
pod repo remove trunk
修改项目ios/Podfile文件,添加:
source 'https://github.com/CocoaPods/Specs.git'
Flutter windows执行flutter doctor报错:
HTTP Host Availability ✗ HTTP host https://maven.google.com/ is not reachable. Reason: An error occurred while checking the HTTP host: Operation timed out
解决方法:
1.找到flutter sdk的文件目录,打开flutter\packages\flutter_tools\lib\src\http_host_validator.dart
2.将https://maven.google.com/修改为https://dl.google.com/dl/android/maven2/,保存退出
3.在flutter\bin目录,删除cache文件夹
4.重新运行终端执行flutter doctor,自动下载文件,解决问题
运行时会卡在Running Gradle task 'assembleDebug', 因为Gradle的Maven仓库在国外, 可以使用阿里云的镜像地址。
修改项目下 build.gradle 和 flutter 安装目录flutter/packages/flutter_tools/gradle/flutter.gradle 两个文件中 buildscript 和allprojects
google() jcenter() //将以上代码替换为以下代码 maven { url 'https://maven.aliyun.com/repository/google' }//google maven { url 'https://maven.aliyun.com/repository/central' }//central maven { url 'https://maven.aliyun.com/repository/public' }//jcenter//public maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}//gradle-plugin
Argon主题版本1.3.5,主页说说code不跟随系统修改颜色,造成黑夜模式下code代码与背景重色。
找到主题css文件:/wordpress/wp-content/themes/argon/assets/argon_css_merged.css
找到以下代码:
pre{font-size:87.5%;display:block;color:#212529;}
删除color:#212529;
在主题设置中关闭CDN,刷新浏览器缓存。
执行flutter doctor 提示错误 CocoaPods not installed.
在终端执行:brew install cocoapods
安装插件Prettier - Code formatter,修改VSCode配置:
{ "editor.formatOnSave": true, //保存自动格式化 "[html]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" } }
在对应主题的functions.php文件里面加入下面的代码:
function disableAutoSave() { wp_deregister_script('autosave'); } add_action('wp_print_scripts','disableAutoSave');