我从字面上刚刚开始第一次应用程序开发和默认项目时,我创建一个新的没有建立。我曾尝试在Google和SO上查找这些错误,并发现了一些,但他们的解决方案无法正常工作。鉴于我没有编辑过这些文件,我认为这是Android Studio未正确设置的问题,但无法弄清楚。这些错误如下:Android工作室默认项目失败:错误:无法解决:com.android.support:support-v4:25.2.0
Error:Failed to resolve: com.android.support:support-v4:25.2.0
Install Repository and sync project
Open File
Show in Project Structure dialog
Error:(23, 24) Failed to resolve: com.android.support.test.espresso:espresso-core:2.2.2
Install Repository and sync project
Show in File
Show in Project Structure dialog
Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:26.+
Install Repository and sync project
Show in File
Show in Project Structure dialog
它指向的build.gradle文件如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.extremecomputing.spotzz"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.google.android.gms:play-services-maps:11.0.1'
testCompile 'junit:junit:4.12'
}
我已经与我创造了一些东西我在网上找到一个以前的项目尝试。比如他们在版本中推荐+
可能会导致不可预测的构建,但事实并非如此。有人在dependencies
部分推荐了一些编译行,它改变了一段时间的错误,说我需要下载一些东西,然后我又回到了原来的错误。我也试图确保SDK工具更新,并且它们似乎是。任何建议将不胜感激。
在SDK管理器中,你有没有安装“Google Repository”? –
当你点击'Install Repository and sync project'时会发生什么? –
有时候什么都没有,有时候屏幕会弹出一个下载。取决于我点击哪一个下载会成功,否则会失败,说连接的某些东西已经关闭。我也刚刚从屏幕右下角的一个闪烁的红色感叹号中发现了这个错误:'连接已关闭:javax.net.ssl.SSLException:java.net.SocketException:软件导致连接中止:recv failed'这是不是它之前显示的确切的错误,而是接近。现在当我点击它时什么都不做,所以我不能显示错误。 – Xandor