我是安卓新手。我正在開發 Firebase 應用程式專案。我已經添加了谷歌服務插件。但它向我顯示了這個錯誤:找不到插件:'com.google.gms.google-services'。
應用程式:gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 32
defaultConfig {
applicationId "com.example.project.app"
minSdkVersion 17
targetSdkVersion 32
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:26. '
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.github.rey5137:material:1.2.5'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'io.paperdb:paperdb:2.6'
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'
implementation 'com.android.support:recyclerview-v7:26. '
}
apply plugin: 'com.gooogle.gms.google-services'
uj5u.com熱心網友回復:
你是安卓新手。
所以首先嘗試 Invalidate Cachce Restart 或清理專案。
uj5u.com熱心網友回復:
在您的專案中,您有兩個build.gradle檔案,一個在root檔案夾中,另一個在app檔案夾中。您需要將這行代碼添加到build.gradle根檔案夾中的檔案中
如果你使用 Gradle Kotlin DSL
plugins {
id "com.android.application" version "7.2.1" apply false
id "com.android.library" version "7.2.1" apply false
id "com.google.gms.google-services" version "4.3.13" apply false
}
或者
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.google.gms:google-services:4.3.13'
}
}
allprojects {
repositories {
mavenCentral()
google()
}
}
只有在那之后,您才能build.gradle在您的app檔案夾中添加和編譯它:
如果你使用 Gradle Kotlin DSL
plugins {
id "com.android.application"
id "com.google.gms.google-services"
}
或者
apply plugin: 'com.gooogle.gms.google-services'
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/509879.html
標籤:爪哇安卓毕业典礼
上一篇:無法在AndroidSDKAPI31級Unity版本2019.4.31f1上構建構建
下一篇:java.lang.NoClassDefFoundError:com/fasterxml/jackson/databind/ser/FilterProvider
