![](/img/trans.png)
[英]Android Studio “Failed to resolve: com.android.support:support-core-utils:23.2.1”
[英]Firebase not working Android Studio 3.0.1 [com.android.support:support-core-utils:27.1.0]
我正在嘗試將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
}
但是,當我同步項目時,出現以下錯誤:
錯誤:(13,0)在類型org.gradle.api.internal.artifacts.dsl.dependencies類型的對象上找不到參數[com.android.support:support-core-utils:27.1.0]的方法compile() .DefaultDependencyHandler。
請從Android SDK Manager安裝Android支持存儲庫。
但這已安裝: 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'
最新版本
您試圖將compile
依賴項添加到您的項目buildscript中,這是無效的。 您只應將classpath
依賴項添加到您的buildscript中,即可有效地充當Gradle構建的插件。
compile
依賴項將使用您應用程序的build.gradle,該文件通常位於app文件夾中。 這些是用於構建應用程序的SDK組件。
如果要在應用程序中使用compile "com.android.support:support-core-utils:27.1.0"
,請將其從buildscript依賴項移至應用程序依賴項。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.