避免在网络文件夹上创建 .DS_Store 文件
https://support.apple.com/en-us/HT208209
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
运行后重新登录即可。
https://support.apple.com/en-us/HT208209
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
运行后重新登录即可。
git ls-files -ziX .gitignore | xargs -0 git rm
缺点是如果仓库里有多个 .gitignore
文件,只能覆盖到当前目录的。
另一种比较危险的方案是移除所有文件再添加,注意先确保工作区干净。
git rm -r --cached .
git add .
旧版本 Android 的模拟器可能出现调用 Canvas.clipPath() 导致 app 崩溃的现象。这是因为模拟器在过低的 API 级别下启用了 Canvas 的硬件加速1,在对应 API 级别下强制关闭硬件加速就好了。
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.UnsupportedOperationException
at android.view.GLES20Canvas.clipPath(GLES20Canvas.java:408)
If your application is affected by any of these missing features or limitations, you can turn off hardware acceleration for just the affected portion of your application by calling setLayerType(View.LAYER_TYPE_SOFTWARE, null)
. This way, you can still take advantage of hardware acceleration everywhere else. See Control hardware acceleration for more information on how to enable and disable hardware acceleration at different levels in your application.
菜单中选择 ... -> Phone -> SMS message,发送短信后进入模拟器的短信应用就可以将文本复制到模拟器内的剪贴板了。
Android Emulator Copy & Paste: Back by popular demand, we added back the Copy & Paste feature to the latest Emulator (v25.3.1). We have a shared clipboard between the Android Emulator and host operating system, which will allow you to copy text between both environments. Copy & Paste works with x86 Google API Emulator system images API Level 19 (Android 4.4 - Kitkat) and higher.
如果镜像 API Level 高于 18,直接复制粘贴就好,和系统剪贴板互通。
如果 Android 模拟器无法上网,测试 adb shell
里 ping 域名解析不出 IP,可以试试用 ./emulator/emulator -avd <name> -dns-server 1.1.1.1
启动。
When starting the emulator at the command line, you can also use the-dns-server <serverList>
option to manually specify the addresses of DNS servers to use, where<serverList>
is a comma-separated list of server names or IP addresses. You might find this option useful if you encounter DNS resolution problems in the emulated network (for example, an "Unknown Host error" message that appears when using the web browser).
https://developer.android.com/studio/run/emulator-networking#dns