android studio 新建项目报错的解决之路
作者:shellrl 时间:2022-09-20 14:24:58
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
来源:https://blog.csdn.net/shellrl/article/details/104847056
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Java Swing组件编程之JTable表格用法实例详解
![](https://img.aspxhome.com/file/2023/5/76195_0s.jpg)
Kotlin协程操作之创建启动挂起恢复详解
android教程之把自己的应用加入到系统分享中
SpringBoot中使用 RabbitMQ的教程详解
![](https://img.aspxhome.com/file/2023/9/113409_0s.jpg)
Android实现后台服务拍照功能
Android框架Volley使用:ImageRequest请求实现图片加载
![](https://img.aspxhome.com/file/2023/5/113325_0s.jpg)
使用Spring Boot Mybatis 搞反向工程的步骤
![](https://img.aspxhome.com/file/2023/9/86809_0s.png)
详解Android短信的发送和广播接收实现短信的监听
IDEA将Maven项目中指定文件夹下的xml等文件编译进classes的方法
![](https://img.aspxhome.com/file/2023/6/122286_0s.png)
C#仿密保卡功能的简单实现代码
![](https://img.aspxhome.com/file/2023/2/94562_0s.png)
老生常谈 Java中的继承(必看)
![](https://img.aspxhome.com/file/2023/2/80982_0s.jpg)
SpringBoot整合Web之AOP配置详解
![](https://img.aspxhome.com/file/2023/5/85885_0s.png)
Android 在viewPager中双指缩放图片双击缩放图片单指拖拽图片的实现思路
C++ 异常处理 catch(...)介绍
MyBatis-Plus逻辑删除和字段自动填充的实现
![](https://img.aspxhome.com/file/2023/9/80289_0s.png)
完美解决PermGen space异常的问题
![](https://img.aspxhome.com/file/2023/6/70516_0s.jpg)
idea右键没有java class选项问题解决方案
![](https://img.aspxhome.com/file/2023/4/132224_0s.png)
android 线性布局LinearLayout实例代码
![](https://img.aspxhome.com/file/2023/7/137527_0s.jpg)
C# Invoke,begininvoke的用法详解
一文搞懂Java顶层类之Object类的使用
![](https://img.aspxhome.com/file/2023/0/115970_0s.png)