Android:获取错误:任务执行失败';:app:processDebugGoogleServices';在添加新的依赖项之后
完整错误跟踪:Android:获取错误:任务执行失败';:app:processDebugGoogleServices';在添加新的依赖项之后,android,tensorflow,gradle,android-gradle-plugin,firebase-mlkit,Android,Tensorflow,Gradle,Android Gradle Plugin,Firebase Mlkit,完整错误跟踪: Error:Execution failed for task ':app:processDebugGoogleServices'. > Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/and
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.4.2.
添加最后一个依赖项时出错:
compile 'com.google.firebase:firebase-ml-model-interpreter:16.2.0'
以下是我的gradle依赖项:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
compile 'com.facebook.android:facebook-login:4.27.0'
compile 'com.firebaseui:firebase-ui-database:2.0.1'
compile 'com.firebaseui:firebase-ui-storage:2.0.1'
compile 'com.firebase:firebase-jobdispatcher:0.6.0'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-ads:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-storage:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
implementation 'com.android.support:support-v4:25.4.0'
implementation 'com.android.support:support-vector-drawable:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.github.chrisbanes:PhotoView:2.1.3'
//network
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true
}
//billing
compile 'com.anjlab.android.iab.v3:library:1.0.44'
//tutorial
compile 'com.github.popalay:tutors:1.0.6'
//rate dialog
compile 'io.github.kobakei:ratethisapp:1.2.0'
compile 'com.github.tozny:java-aes-crypto:1.1.0'
compile 'com.flurry.android:analytics:8.1.0'
compile 'com.github.ceryle:RadioRealButton:v2.1.1'
compile 'com.github.drawers:SpinnerDatePicker:1.0.6'
/* compile 'com.siclo.ezphotopick:library:1.0.8'
implementation project(':EZPhotoPickerLib')*/
compile project(path: ':EZPhotoPickerLib')
compile "commons-io:commons-io:2.6"
compile "com.github.hotchemi:permissionsdispatcher:3.1.0"
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:3.1.0"
compile 'org.tensorflow:tensorflow-lite:+'
compile 'com.google.firebase:firebase-ml-model-interpreter:16.2.0'
}
apply plugin: 'com.google.gms.google-services'
尝试同步LIB,但无论我做什么,都会不断出现此错误。转到项目级生成并替换
classpath 'com.google.gms:google-services:3.x.x'
与
并同步您的代码
因为在您的应用程序gradle中,您使用的是mi modal解释器lastes,它具有与gsm最新版本兼容的依赖项版本。而您使用的是旧版本google.gsm,这会混淆版本冲突
如果您将google.gsm更新为4.x.x,则可能需要将google的其他所有依赖项更新为最新版本。在将这些ui更新为firebase.ui:3.x.x时,您也在使用firebase.ui:2.x.x,那么您也需要更改代码,因为其中一些方法是ui:2.x.x,也会被新方法替换
转到项目级生成并替换
classpath 'com.google.gms:google-services:3.x.x'
与
并同步您的代码
因为在您的应用程序gradle中,您使用的是mi modal解释器lastes,它具有与gsm最新版本兼容的依赖项版本。而您使用的是旧版本google.gsm,这会混淆版本冲突
如果您将google.gsm更新为4.x.x,则可能需要将google的其他所有依赖项更新为最新版本。在将这些ui更新为firebase.ui:3.x.x时,您也在使用firebase.ui:2.x.x,那么您也需要更改代码,因为其中一些方法是ui:2.x.x,也会被新方法替换
对于Firebase依赖项:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
compile 'com.facebook.android:facebook-login:4.27.0'
compile 'com.firebaseui:firebase-ui-database:2.0.1'
compile 'com.firebaseui:firebase-ui-storage:2.0.1'
compile 'com.firebase:firebase-jobdispatcher:0.6.0'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-ads:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-storage:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
implementation 'com.android.support:support-v4:25.4.0'
implementation 'com.android.support:support-vector-drawable:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.github.chrisbanes:PhotoView:2.1.3'
//network
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true
}
//billing
compile 'com.anjlab.android.iab.v3:library:1.0.44'
//tutorial
compile 'com.github.popalay:tutors:1.0.6'
//rate dialog
compile 'io.github.kobakei:ratethisapp:1.2.0'
compile 'com.github.tozny:java-aes-crypto:1.1.0'
compile 'com.flurry.android:analytics:8.1.0'
compile 'com.github.ceryle:RadioRealButton:v2.1.1'
compile 'com.github.drawers:SpinnerDatePicker:1.0.6'
/* compile 'com.siclo.ezphotopick:library:1.0.8'
implementation project(':EZPhotoPickerLib')*/
compile project(path: ':EZPhotoPickerLib')
compile "commons-io:commons-io:2.6"
compile "com.github.hotchemi:permissionsdispatcher:3.1.0"
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:3.1.0"
compile 'org.tensorflow:tensorflow-lite:+'
compile 'com.google.firebase:firebase-ml-model-interpreter:16.2.0'
}
apply plugin: 'com.google.gms.google-services'
对于Firebase依赖项:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
compile 'com.facebook.android:facebook-login:4.27.0'
compile 'com.firebaseui:firebase-ui-database:2.0.1'
compile 'com.firebaseui:firebase-ui-storage:2.0.1'
compile 'com.firebase:firebase-jobdispatcher:0.6.0'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-ads:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-storage:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
implementation 'com.android.support:support-v4:25.4.0'
implementation 'com.android.support:support-vector-drawable:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.github.chrisbanes:PhotoView:2.1.3'
//network
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true
}
//billing
compile 'com.anjlab.android.iab.v3:library:1.0.44'
//tutorial
compile 'com.github.popalay:tutors:1.0.6'
//rate dialog
compile 'io.github.kobakei:ratethisapp:1.2.0'
compile 'com.github.tozny:java-aes-crypto:1.1.0'
compile 'com.flurry.android:analytics:8.1.0'
compile 'com.github.ceryle:RadioRealButton:v2.1.1'
compile 'com.github.drawers:SpinnerDatePicker:1.0.6'
/* compile 'com.siclo.ezphotopick:library:1.0.8'
implementation project(':EZPhotoPickerLib')*/
compile project(path: ':EZPhotoPickerLib')
compile "commons-io:commons-io:2.6"
compile "com.github.hotchemi:permissionsdispatcher:3.1.0"
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:3.1.0"
compile 'org.tensorflow:tensorflow-lite:+'
compile 'com.google.firebase:firebase-ml-model-interpreter:16.2.0'
}
apply plugin: 'com.google.gms.google-services'
再次检查官方网站文档 在Android上使用Lite模型和ML工具包进行推理 您可以使用ML工具包对TensorFlow Lite模型执行设备推断 此API需要Android SDK级别16(Jelly Bean)或更高版本 请参阅GitHub上的ML Kit quickstart示例以了解此API的使用示例,或者尝试codelab 在你开始之前 如果尚未将Firebase添加到应用程序中,请按照中的步骤进行操作。 在应用程序级别build.gradle文件中包含ML工具包的依赖项:
dependencies {
// ...
implementation 'com.google.firebase:firebase-ml-model-interpreter:16.2.0'
}
将要使用的TensorFlow模型转换为TensorFlow Lite(tflite)格式。看
托管或捆绑您的模型
在应用程序中使用TensorFlow Lite模型进行推理之前,必须将该模型提供给ML工具包。ML工具包可以使用使用Firebase远程托管的TensorFlow Lite模型,或者本地存储在设备上,或者两者兼有
通过在Firebase上托管模型并在本地存储模型,您可以确保在模型可用时使用模型的最新版本,但当Firebase托管模型不可用时,您的应用程序的ML功能仍然有效
模型安全性
无论如何使TensorFlow Lite模型可用于ML Kit,ML Kit都会将它们以标准序列化protobuf格式存储在本地存储中
理论上,这意味着任何人都可以复制你的模型。然而,在实践中,大多数模型都是特定于应用程序的,并且由于优化而变得模糊,其风险与竞争对手分解和重用代码的风险相似。然而,在应用程序中使用自定义模型之前,您应该意识到这种风险
在Android API level 21(棒棒糖)及更新版本上,可以下载该模型
到
在Android API level 20及更高版本上,模型下载到应用程序私有内部存储中名为com.google.firebase.ml.custom.models的目录中。如果使用BackupAgent启用了文件备份,则可以选择排除此目录
有关更多详细信息,请查看参考:
作为最后一个答案,更新梯度再次检查官方网站文档 在Android上使用Lite模型和ML工具包进行推理 您可以使用ML工具包对TensorFlow Lite模型执行设备推断 此API需要Android SDK级别16(Jelly Bean)或更高版本 请参阅GitHub上的ML Kit quickstart示例以了解此API的使用示例,或者尝试codelab 在你开始之前 如果尚未将Firebase添加到应用程序中,请按照中的步骤进行操作。 在应用程序级别build.gradle文件中包含ML工具包的依赖项:
dependencies {
// ...
implementation 'com.google.firebase:firebase-ml-model-interpreter:16.2.0'
}
将要使用的TensorFlow模型转换为TensorFlow Lite(tflite)格式。看
托管或捆绑您的模型
在应用程序中使用TensorFlow Lite模型进行推理之前,必须将该模型提供给ML工具包。ML套件可以使用TensorFlow Lite模式