同步Gradle文件后,我一直遇到这些问题。我的gradle文件看起来像这样。
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.calcounter.whattappclone"
minSdkVersion 15
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-rc02'
implementation 'com.android.support:design:28.0.0-rc02'
implementation 'com.andriod.support:support-v4:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
// FirebaseUI for Firebase Realtime Database
implementation 'com.firebaseui:firebase-ui-database:3.2.2'
implementation 'com.andriod.support:support-v4:27.0.0-rc01'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
implementation 'com.squareup.picasso:picasso:2.71828'
testImplementation 'junit:junit:4.12'
//implementation 'com.android.support:support-annotations:27.1.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
**这是我一直在使用的gradle.project文件,仍然发生错误,我尝试更改依赖项,但仍然发生相同的错误
buildscript {
repositories {
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
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
有什么解决方案吗?请
答案 0 :(得分:1)
使用相同的版本和最新的稳定版本:
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.andriod.support:support-v4:28.0.0'
然后删除重复的(support-v4
)一个。也要在根gradle
中更新build.gradle
:
classpath 'com.android.tools.build:gradle:3.2.1'
答案 1 :(得分:0)
我有类似的问题。原来,我在设置中勾选了“离线工作”,这阻止了Android Studio上网寻求依赖。我没有对本地存储库的必需依赖项,因此“无法解决..”一直在发生。 关闭它可以解决问题。 当我想到这一点时,这是显而易见的,但它吸引了我。