【发布时间】:2019-07-26 00:07:38
【问题描述】:
我看到了一些与此错误相关的类似问题。但我无法解决问题。 我正在使用 firebase ml 工具包来识别图像中的文本。我已将 google-services.json 文件添加到 app 目录,但仍然出现同样的错误。如果有人可以解决此问题,请告诉我。
我收到以下错误:
File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
E:\Practices\Android Projects\2019\DataFactor\app\src\nullnull\debug\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\src\debug\nullnull\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\src\nullnull\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\src\debug\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\src\nullnullDebug\google-services.json
E:\Practices\Android Projects\2019\DataFactor\app\google-services.json
我的 build.gradle 项目:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的应用程序 build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "app.shakil.com.datafactor"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.+'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.+'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-ml-vision:19.0.2'
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'
}
apply plugin: 'com.google.gms.google-services'
【问题讨论】:
-
Play 服务插件不同意您将文件放在正确的位置。它甚至会告诉你它检查过的地点列表。
-
你找到答案了吗?我也面临同样的问题。
-
是的,我找到了答案。我放错了 json 文件。尝试将 json 文件放在正确的目录中。我只是将 json 文件从项目级别移动到应用级别。
标签: android firebase android-studio firebase-mlkit