android studio 新建專案報錯的解決之路
android studio 新建工程報錯
Error:Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not resolve com.android.support:appcompat-v7:26.0.0-beta1.
Required by:
project :app
> Could not resolve com.android.support:appcompat-v7:26.0.0-beta1.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.0.0-beta1/appcompat-v7-26.0.0-beta1.pom'.> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.0.0-beta1/appcompat-v7-26.0.0-beta1.pom'.
> Connect to dl.google.com:443 [dl.google.com/203.208.46.146] failed: Operation timed out (Connection timed out)
1、取消代理
Preferences->Appearance & Behavior->System Settings->Http Proxy
2、取消隱藏代理
關掉隱形代理在mac 上對應的目錄:~/.gradle/gradle.properties
3、
Preferences->Build,Execution,Deployment->Gradle,取消“offline work”的勾選,讓studio去下載即可。
4、
Preferences->Build,Deployment->Gradle->Android Studio
取消勾選Disable embedded Maven Repository
5、修改project的bulid.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }
在兩個repository加了,阿里雲的映象
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
再次sync,問題解決,但是把maven去掉,也能正常sync,有點迷,前幾步,我的as本來就配好沒有修改,猜測可能是wifi不好。。。
知識點補充:Android Studio 新建工程報錯“”Error occurred during initialization of VM ..."解決辦法
Android Studio 新建工程報錯:
Error occurred during initialization of VM Could not reserve enough space for 1572864KB object heap
You encounter following error:
Error occurred during initialization of VM Could not reserve enough space for 1572864KB object heap
原因:Java虛擬機器(JVM)沒有足夠的記憶體空間。
解決方案:
1:在個人資料夾( (C:/Users/username/.gradle 或 ~/.gradle))下建立gradle.properties檔案,新增
org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m
2:或者直接在Android Studio中gradle.properties檔案中新增下面這行,存在則修改
org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m
總結
到此這篇關於android studio 新建專案報錯解決之路的文章就介紹到這了,更多相關android studio 新建工程報錯內容請搜尋我們以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援我們!