总结项目编译遇到的几个问题(Android Studio Mac系统)

希望自己的一些解决问题的经历可以分享给需要的各位

在运行项目的过程中,或多或少都会遇到一些编译的问题,项目跑不起来的感觉真的让人真着急,相信每一个程序员都感同身受,折腾了一天半,解决了自己项目的编译问题,迫不及待的分享给需要的那个你。

问题1:Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

问题描述

Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
Re-download dependencies and sync project (requires network)

解决方案

1.打开项目中的 gradle-wrapper.properties 文件
2.将会看到这样一行指定下载gradle的地址:distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip
3.将https改成http 或者 将all改成bin

原因

待续

问题二:Connect to dl.google.com:443 no response

问题描述

Connect to dl.google.com:443 no response

解决方案

在xxx\android-studio\gradle\m2repository\com\android\tools\build\gradle找到已经下载好的版本替换一下

原因

待续

问题三:WARNING: The following project options are deprecated and have been removed:

问题描述

ERROR: Unable to resolve dependency for ‘:app@debug/compileClasspath’: Could not resolve com.android.support:appcompat-v7:28.0.0.
Show Details
Affected Modules: app
WARNING: The following project options are deprecated and have been removed:
android.enableAapt2
This property has no effect, AAPT2 is now always used.

解决方案

移除gradle.properties中android.enableAapt2=true

原因

28.0.0已经不支持AAPT2,移除相关配置即可

问题四:You have JVM property “socksProxyHost” 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.)

解决方案

重启电脑

原因

我猜测可能是因为端口冲突

问题五:Could not find builder.jar (com.android.tools.build:builder:3.1.0). Searched in the following locations:

问题描述

Could not find builder.jar (com.android.tools.build:builder:3.1.0). Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.1.0/builder-3.1.0.jar
其实也不针对3.1.0,任何一个版本的jar都可能出现这个问题

解决方案

针对Mac

原因

我猜测是代理不支持https的下载

猜你喜欢

转载自blog.csdn.net/Android_Glimmer/article/details/89402925