这篇文章主要介绍了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、取消隐藏代理
关掉隐形代理在mac 上对应的目录:~/.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)没有足够的内存空间。
解决方案:
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 新建工程报错内容请搜索编程学习网以前的文章希望大家以后多多支持编程学习网!
本文标题为:android studio 新建项目报错的解决之路
基础教程推荐
- iOS中如何判断当前网络环境是2G/3G/4G/5G/WiFi 2023-06-18
- iOS开发 全机型适配解决方法 2023-01-14
- iOS Crash常规跟踪方法及Bugly集成运用详细介绍 2023-01-18
- Android Compose自定义TextField实现自定义的输入框 2023-05-13
- IOS获取系统相册中照片的示例代码 2023-01-03
- Flutter进阶之实现动画效果(三) 2022-10-28
- Android实现短信验证码输入框 2023-04-29
- Android开发Compose集成高德地图实例 2023-06-15
- iOS开发使用XML解析网络数据 2022-11-12
- MVVMLight项目Model View结构及全局视图模型注入器 2023-05-07