代码改变世界

随笔分类 -  Android

[Network] 判断设备是否能访问 Internet

2021-02-10 15:44 by shaobin0604, 486 阅读, 收藏, 编辑
摘要: Android API Level 21 新增 API android.net.NetworkCapabilities 判断是否能访问 Internet val networkCapabilities = connectivityManager.getNetworkCapabilities(conn 阅读全文

[Android] 从 logcat 日志中获取设备的 mac 地址信息

2020-09-01 13:56 by shaobin0604, 465 阅读, 收藏, 编辑
摘要: 关键 TAG WifiStateMachine 09-01 02:01:21.450 3624 3762 D WifiStateMachine: CMD_START_CONNECT sup state UninitializedState my state DisconnectedState nid 阅读全文

[Android Tips] 33. Lottie 在 RecyclerView onBindViewHolder 中 playAnimation 不生效

2020-06-10 16:42 by shaobin0604, 1000 阅读, 收藏, 编辑
摘要: 现象 解决 @Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { lavCircleProgress.post(new Runnable() { @Override public void 阅读全文

[Gradle] 解决高德 jar 包打包到 aar 后 jar 包中的 assets 内容丢失

2019-08-01 18:04 by shaobin0604, 1826 阅读, 收藏, 编辑
摘要: 问题描述 将高德 SDK 的 jar 包放到 android library project libs 目录下,发布为 aar 包后,发现高德 jar 包中的 assets 目录下的内容不见了 原因见: "打包APK导致Assets文件夹丢失地图白屏怎么办?" 如何解决 将高德 SDK 的 jar 阅读全文

[Android Tips] 32. 解决 Android Device Monitor 在 Mac OS X 卡住

2018-07-31 20:54 by shaobin0604, 1099 阅读, 收藏, 编辑
摘要: Alternatively you can keep latest jdk and update swt used by monitor: get updated swt: https://www.eclipse.org/downloads/download.php?file=/eclipse/do 阅读全文

[Android Tips] 31.如何将第三库引入的 Permission 删除掉

2018-04-16 15:14 by shaobin0604, 890 阅读, 收藏, 编辑
摘要: Just declare the incriminated permission in your (main) Manifest with the attribute (yes, that’s exactly how we fixed it). For example: Even if anothe 阅读全文

[Android Tips] 30.如何在 Android Studio 中一次性格式化所有代码

2018-01-12 20:28 by shaobin0604, 1631 阅读, 收藏, 编辑
摘要: 在目录上面右击,有 Reformat Code Ctrl + Alt + L 参考 "如何在IntelliJ IDEA或Android Studio中一次性格式化所有代码?" 阅读全文

[Android Tips] 29. 如何判断当前编译的是哪个 Flavor ?

2017-12-01 11:48 by shaobin0604, 2392 阅读, 收藏, 编辑
摘要: 背景说明 应用需要针对不同的市场集成不同的第三方 SDK ,比如:面向海市场的版本需要集成 google service 解决方案 参考 "How to apply plugin to only one flavor in gradle?" 阅读全文

[Android Tips] 28. 如何指定运行特定的 Android Instrumentation Test

2017-09-21 12:57 by shaobin0604, 168 阅读, 收藏, 编辑
摘要: TBD 阅读全文

[Android Tips] 27. 检查 APK 是否可调试

2017-07-03 16:08 by shaobin0604, 736 阅读, 收藏, 编辑
摘要: 使用 Android SDK 提供的 aapt 检查 APK 文件 检查自身 检查其他应用 阅读全文

[Android Tips] 26. Multiple Maven repositories in Gradle

2017-05-18 14:01 by shaobin0604, 288 阅读, 收藏, 编辑
摘要: 来自 https://gradleproject.wordpress.com/2013/02/14/multiple maven repositories in gradle/ This DOESN’T work: This works 阅读全文

[Android Tips] 25. ADB Command Note

2016-12-08 17:26 by shaobin0604, 310 阅读, 收藏, 编辑
摘要: copy from https://github.com/operando/Android-Command-Note Android Command Note Logcat adb logcat -v time adb logcat -v time -b main adb logcat -v tim 阅读全文

[Android Tips] 24. Gradle listing project dependencies

2016-08-26 11:46 by shaobin0604, 227 阅读, 收藏, 编辑
摘要: or install this Android Studio Plugin https://github.com/rholder/gradle view 阅读全文

[Android Tips] 23. How to fail/stop Gradle task immediately if some conditions are not met

2016-08-16 14:18 by shaobin0604, 265 阅读, 收藏, 编辑
摘要: 参考 "How to fail/stop task immediately if some conditions are not met" 阅读全文

[Android Tips] 22. Available Java 7 Features in Android

2016-07-16 11:53 by shaobin0604, 268 阅读, 收藏, 编辑
摘要: This only allows Java 7 language features, and you can hardly benefit from anything since a half of improvement also comes from the library. Features 阅读全文

[Android Tips] 21. Regex Named Groups in Android

2016-07-12 20:53 by shaobin0604, 495 阅读, 收藏, 编辑
摘要: Android SDK 并没有包含 Java 7 新增加的命名捕获组功能,需要使用第三方库 https://github.com/tony19/named regexp 参考 "Regex Named Groups in Java" "Java Regex Helper" "Named Captur 阅读全文

[Android Tips] 20. Android Studio Tips

2016-06-24 10:34 by shaobin0604, 218 阅读, 收藏, 编辑
摘要: "【译】Android Studio 使用技巧系列(一) 快捷键" "【译】Android Studio 使用技巧系列(二) 快捷键" "【译】Android Studio 使用技巧系列(三) 调试" "【译】Android Studio 使用技巧系列(四)" "【译】Android Studio 阅读全文

[Android Tips] 19. Android Studio Plugins

2016-06-23 14:30 by shaobin0604, 241 阅读, 收藏, 编辑
摘要: Code Generation GsonFormat json 字符串生成实体类 https://github.com/zzz40500/GsonFormat Android Parcelable Code Generator 实体类生成实现 接口 https://github.com/mcharm 阅读全文

[Android Tips] 18. Enable/Disable WiFi via adb

2016-05-12 10:43 by shaobin0604, 286 阅读, 收藏, 编辑
摘要: "Awesome ADB" 阅读全文

[Android Tips] 17. 查看 APK 签名信息

2016-02-23 11:36 by shaobin0604, 287 阅读, 收藏, 编辑
摘要: 从 APK 文件中获取签名信息 方法一 方法二 解压 APK 文件,释放出 从签名文件中获取签名信息 参考 "Android签名相关知识整理" https://github.com/bihe0832/Android GetAPKInfo 阅读全文