在 gradle 错误中,android 工作室需要你的帮助
I need your help whith android studio in the gradle error
我想在我的项目中实施 Firebase,但以下错误不允许我这样做。我需要你的帮助。
我正在 squiggly lines Appcompat 依赖:
implementation 'com.android.support:appcompat-v7:27.1.1'
gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.steven.musica"
minSdkVersion 24
targetSdkVersion 27
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:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.google.firebase:firebase-core:15.0.0'
}
apply plugin: 'com.google.gms.google-services'
库 appcompat-v7 和 support-v7 必须具有相同的版本。
在您的依赖项中,您有 appcompat-v7:27.1.1
并隐藏在 firebase-core:15.0.0
中,您有 support-v4:26.1.0
添加 implementation 'com.android.support:support-v4:27.1.1'
以强制 firebase-core 使用版本 27.1.1
因为你还没有显示你的 build.gradle
文件,我假设你已经按照 Firebase documentation 中的说明更新了它,方法是:
classpath 'com.google.gms:google-services:3.2.0' // google-services plugin
和 Maven 存储库
maven {
url "https://maven.google.com" // Google's Maven repository
}
此外,请更改此:
compile 'com.google.firebase:firebase-core:15.0.0'
到这个
implementation 'com.google.firebase:firebase-core:15.0.0'
编辑:
我添加了一个截图来帮助你更好。
转到 Gradle Scripts > build.Gradle(Project)
并添加我用蓝色突出显示的内容,然后单击 SyncNow
注意:不要更改默认值 build:gradle:version
,因为我的是 build:gradle:3.0.1
只需复制 goole-services 插件 和 Maven 存储库,如屏幕截图中所引用。
我想在我的项目中实施 Firebase,但以下错误不允许我这样做。我需要你的帮助。
我正在 squiggly lines Appcompat 依赖:
implementation 'com.android.support:appcompat-v7:27.1.1'
gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.steven.musica"
minSdkVersion 24
targetSdkVersion 27
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:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.google.firebase:firebase-core:15.0.0'
}
apply plugin: 'com.google.gms.google-services'
库 appcompat-v7 和 support-v7 必须具有相同的版本。
在您的依赖项中,您有 appcompat-v7:27.1.1
并隐藏在 firebase-core:15.0.0
中,您有 support-v4:26.1.0
添加 implementation 'com.android.support:support-v4:27.1.1'
以强制 firebase-core 使用版本 27.1.1
因为你还没有显示你的 build.gradle
文件,我假设你已经按照 Firebase documentation 中的说明更新了它,方法是:
classpath 'com.google.gms:google-services:3.2.0' // google-services plugin
和 Maven 存储库
maven {
url "https://maven.google.com" // Google's Maven repository
}
此外,请更改此:
compile 'com.google.firebase:firebase-core:15.0.0'
到这个
implementation 'com.google.firebase:firebase-core:15.0.0'
编辑: 我添加了一个截图来帮助你更好。
转到 Gradle Scripts > build.Gradle(Project)
并添加我用蓝色突出显示的内容,然后单击 SyncNow
注意:不要更改默认值 build:gradle:version
,因为我的是 build:gradle:3.0.1
只需复制 goole-services 插件 和 Maven 存储库,如屏幕截图中所引用。