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
選擇 No Proxy
2、取消隱藏代理
關(guān)掉隱形代理在mac 上對應(yīng)的目錄:~/.gradle/gradle.properties
3、
Preferences->Build,Execution,Deployment->Gradle,取消“offline work”的勾選,讓studio去下載即可。
4、
Preferences->Build,Execution,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)沒有足夠的內(nèi)存空間。
解決方案:
1:在個人文件夾( (C:/Users/username/.gradle 或 ~/.gradle))下創(chuàng)建gradle.properties文件,添加
org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m
2:或者直接在Android Studio中g(shù)radle.properties文件中添加下面這行,存在則修改
org.gradle.jvmargs=-Xmx512m -XX:MaxPermSize=512m
總結(jié)
到此這篇關(guān)于android studio 新建項目報錯解決之路的文章就介紹到這了,更多相關(guān)android studio 新建工程報錯內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Android中AlertDialog 點擊按鈕后不關(guān)閉對話框的功能
本篇文章主要介紹了Android中AlertDialog 點擊按鈕后不關(guān)閉對話框的功能,非常具有實用價值,需要的朋友可以參考下2017-04-04
基于Android實現(xiàn)的文件同步設(shè)計方案
隨著用戶對自身數(shù)據(jù)保護意識的加強,讓用戶自己維護自己的數(shù)據(jù)也成了獨立開發(fā)產(chǎn)品時的一個賣點,若只針對少量的文件進行同步,則實現(xiàn)起來比較簡單,當針對一個多層級目錄同步時,情況就復(fù)雜多了,本文我分享下我的設(shè)計思路2023-10-10
Android基于廣播事件機制實現(xiàn)簡單定時提醒功能代碼
這篇文章主要介紹了Android基于廣播事件機制實現(xiàn)簡單定時提醒功能代碼,較為詳細的分析了Android廣播事件機制及提醒功能的相關(guān)實現(xiàn)技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-10-10
Android Intent實現(xiàn)頁面跳轉(zhuǎn)的兩種方法
這篇文章主要介紹了Android Intent實現(xiàn)頁面跳轉(zhuǎn)的兩種方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-05-05
Android實現(xiàn)從底部彈出的Dialog示例(一)
這篇文章主要介紹了Android實現(xiàn)從底部彈出的Dialog示例(一),具有一定的參考價值,感興趣的小伙伴們可以參考一下。2017-01-01
探討:android項目開發(fā) 統(tǒng)籌兼顧 需要考慮的因素
本篇文章是對基于android項目開發(fā) 統(tǒng)籌兼顧 需要考慮的因素進行了詳細的分析介紹,需要的朋友參考下2013-06-06

