不好意思,我刚刚开始学习android开发。
我已经安装了android studio 3.2,并创建了一个新项目。没有任何编辑,并得到了这个。
我在Google上搜索了很多,并尝试过:
settings-->gradle-->offline work
maven { url 'http://repo1.maven.org/maven2' }
它仍然不起作用。
build.gradle
buildscript {
repositories {
//maven { url 'http://repo1.maven.org/maven2' }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.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
}
app / build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.my.testapp.activitylifecycletest"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
非常感谢!
答案 0 :(得分:0)
相同情况,您可以检查代理设置。 在gradle / gradle-wrapper.properties文件中,添加代理设置,如下所示
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080