Android Stuio编译报错

  1. 代理设置问题

问题:

You have JVM property https- proxyHost set to 127.0.0.1. This may lead to incorrect behaviour. Proxy should be set in
Settings | HTTP Proxy. This JVM property is old and its usage is not recommended by Oracle. (Note: It could have been assigned
by some code dynamically.)

解决:

https://stackoverflow.com/questions/35520337/how-to-remove-jvm-property-https-proxyhost

Help -> Edit Custom VM Options -> studio.vmoptions -> restart

-Dhttp.proxyHost
-Dhttp.proxyPort
-Dhttps.proxyHost
-Dhttps.proxyPort
-DsocksProxyHost
-DsocksProxyPort

2. 编译时所有的扩展方法报错, 实际代码正确但是编译找不到

问题: 所有的扩展方法都找不到

解决: gradle缓存问题, 清理gradle-build-cache或者去掉缓存构建

https://docs.gradle.org/current/userguide/build_cache.html

3. 完全卸载android studio

https://stackoverflow.com/questions/17625622/how-to-completely-uninstall-android-studio-on-mac

# Deletes the Android Studio application
# Note that this may be different depending on what you named the application as, or whether you downloaded the preview version
rm -Rf /Applications/Android\ Studio.app
# Delete All Android Studio related preferences
# The asterisk here should target all folders/files beginning with the string before it
rm -Rf ~/Library/Preferences/AndroidStudio*
rm -Rf ~/Library/Preferences/Google/AndroidStudio*
# Deletes the Android Studio's plist file
rm -Rf ~/Library/Preferences/com.google.android.*
# Deletes the Android Emulator's plist file
rm -Rf ~/Library/Preferences/com.android.*
# Deletes mainly plugins (or at least according to what mine (Edric) contains)
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Application\ Support/Google/AndroidStudio*
# Deletes all logs that Android Studio outputs
rm -Rf ~/Library/Logs/AndroidStudio*
rm -Rf ~/Library/Logs/Google/AndroidStudio*
# Deletes Android Studio's caches
rm -Rf ~/Library/Caches/AndroidStudio*
rm -Rf ~/Library/Caches/Google/AndroidStudio*
# Deletes older versions of Android Studio
rm -Rf ~/.AndroidStudio*

rm -Rf ~/.gradle
rm -Rf ~/Library/Android*
rm -Rf ~/.emulator_console_auth_token