我正在尝试使用我的项目与Firebase同步,我使用Android Studio-> Firebase中的工具,然后执行Image步骤(这是新项目)。
Android Studio版本 3.0.1
App文件夹中的build.gradle为:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.eranp.fiberbase"
minSdkVersion 19
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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database:11.0.4'
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'
}
apply plugin: 'com.google.gms.google-services'
Project文件夹中的build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
compile "com.android.support:support-core-utils:27.1.0"
// 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.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
但是,当我同步项目时,出现以下错误:
Error:(13, 0) Could not find method compile() for arguments [com.android.support:support-core-utils:27.1.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Please install the Android Support Repository from the Android SDK Manager.
但这已安装:Image。
我尝试使用Firebase工作了一个星期,但所有需要同步的工作。
我怎样才能解决这个问题?
谢谢你的帮忙!
最佳答案
添加后:
compile "com.android.support:support-core-utils:27.1.0"
在app / build.gradle中的依赖项下
那么您需要更改:
compileSdkVersion 26
对此:
compileSdkVersion 27
还将Firebase版本更新为此:
implementation 'com.google.firebase:firebase-database:11.8.0'
最新版本
关于android - Firebase无法正常运行Android Studio 3.0.1 [com.android.support:support-core-utils:27.1.0],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49179950/