簡體   English   中英

錯誤:文件 google-services.json 丟失。 沒有它,Google 服務插件就無法運行。

[英]Error: File google-services.json is missing. The Google Services Plugin cannot function without it.

我已經在我的應用程序中包含了 google-services.json 文件,但它仍然給我錯誤。 錯誤:任務“:app:processDebugGoogleServices”的執行失敗。

文件 google-services.json 丟失。 沒有它,Google 服務插件就無法運行。 搜索位置:C:\\Users\\vikas\\AndroidStudioProjects\\FireBaseFunctionality\\app\\src\\debug\\google-services.json C:\\Users\\vikas\\AndroidStudioProjects\\FireBaseFunctionality\\app\\google-services.json

有同樣的問題 - 在教程的下一步之前構建。 您必須從 firebase 網站生成並下載文件。 請參閱錯誤“模塊根文件夾中缺少文件 google-services.json。如果沒有它,Google 服務插件將無法運行” - 晚了,但現在有人可能需要這個。

進入 SDK 管理器 --> SDK 工具 --> 安裝播放服務和 USB 工具和存儲庫我已經用上述方法解決了同樣的問題

或者你可以更改 google 服務的名稱 google-services.json 而不是 google-services(any number).json

只需在 build.gradle 中更改該行

compile fileTree (dir: 'libs', include: ['* .jar'])

implementation fileTree(dir: 'libs', include: ['*.jar'])

轉到用於構建應用程序的 flutter sdk 文件夾。 刪除文件夾中的所有內容 .pub-cache 現在 pub-get 並運行。

有時我們復制下載的文件並放入應用程序目錄。 但它改變了名稱。 例如 googleservices(1).json 而不是 googleservices.json。 所以請確保文件名正確。

對我有用的是:

然后按照https://console.firebase.google.com步驟在 android studio 中執行:

項目級 build.gradle (/build.gradle):

buildscript {
  repositories {
    // Check that you have the following line (if not, add it):
    google()  // Google's Maven repository

  }
  dependencies {
    ...
    // Add this line
    classpath 'com.google.gms:google-services:4.3.8'

  }
}

allprojects {
  ...
  repositories {
    // Check that you have the following line (if not, add it):
    google()  // Google's Maven repository

    ...
  }
}

應用級 build.gradle (//build.gradle):

apply plugin: 'com.android.application'

// Add this line
apply plugin: 'com.google.gms.google-services'


dependencies {
  // Import the Firebase BoM
  implementation platform('com.google.firebase:firebase-bom:28.3.0')


  // Add the dependency for the Firebase SDK for Google Analytics
  // When using the BoM, don't specify versions in Firebase dependencies
  implementation 'com.google.firebase:firebase-analytics'


  // Add the dependencies for any other desired Firebase products
  // https://firebase.google.com/docs/android/setup#available-libraries
}

最后,在 IDE 中出現的欄中按“立即同步”:

將您的 googleservices(number).json 更改為 googleservices.json no number 它對我有用 我剛剛遇到了同樣的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM