当我想运行我的应用程序时,他们说“配置仍然不正确”,并且还显示Gradle项目同步失败。还有这个。
由于未定义存储库,因此无法解析外部依赖项com.google.gms:google-services:3.1.1。 要求: 项目:app
这是我的build.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.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我的build.gradle(模块)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.eky.biofarma4"
minSdkVersion 19
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:cardview-v7:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:11.6.0'
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'
implementation 'com.android.support:gridlayout-v7:28.0.0-rc02'
}
buildscript {
dependencies {
classpath 'com.google.gms:google-services:3.1.1'
}
}
apply plugin: 'com.google.gms.google-services'
和我的setting.gradle
include ':app'
我已经在SDK Manager中安装了Google Play服务和Google Repository,在查找了某些情况后,我放置了
allprojects {
repositories {
// ...
maven { url "https://maven.google.com" }
}
}
然后我再次尝试使其同步
在类型为org.gradle.initialization.DefaultSettings的设置'Biofarma4'上找不到参数[settings_821vp53luwtcqzqny9o3oudnz $ _run_closure1 @ 189972c9]的方法allprojects()。
在那里应该找到什么?我如何以及在哪里可以摆放它?