Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何压制",;避免使用捆绑版的Google Play services SDK“;警告_Android_Android Studio_Google Play Services - Fatal编程技术网

Android 如何压制",;避免使用捆绑版的Google Play services SDK“;警告

Android 如何压制",;避免使用捆绑版的Google Play services SDK“;警告,android,android-studio,google-play-services,Android,Android Studio,Google Play Services,我在Android应用程序中使用Google Play服务,因此我的build.gradle中有依赖项 compile 'com.google.android.gms:play-services:10.2.1' 但Android Studio对此给出了警告:避免使用捆绑版的Google Play services SDK 这个警告是什么意思?我应该如何避免它?我在谷歌上搜索了很多,但没有找到太多相关的信息 googleplay服务包含许多单独的api。 您可以访问所需的任何内容,而不是访问包

我在Android应用程序中使用Google Play服务,因此我的
build.gradle
中有依赖项

compile 'com.google.android.gms:play-services:10.2.1'
但Android Studio对此给出了警告:
避免使用捆绑版的Google Play services SDK


这个警告是什么意思?我应该如何避免它?我在谷歌上搜索了很多,但没有找到太多相关的信息

googleplay服务包含许多单独的api。 您可以访问所需的任何内容,而不是访问包含所有内容的捆绑包。这是更好的方法。见表1

在6.5之前的Google Play services版本中,您必须将整个API包编译到应用程序中。在某些情况下,这样做会使应用程序中的方法数量(包括框架API、库方法和您自己的代码)难以保持在65536限制之下从6.5版开始,您可以有选择地将Google Play服务API编译到您的应用程序中

内部编译
com.google.android.gms:play services:12.0.0
包含许多依赖项。。见下文。。使用play服务可能会导致dex问题和应用程序负担过重。仅选择您真正依赖的目标:)

火基

Firebase API                Description in build.gradle

Analytics                com.google.firebase:firebase-core:12.0.0
Realtime Database        com.google.firebase:firebase-database:12.0.0    
Cloud Firestore          com.google.firebase:firebase-firestore:12.0.0   
Storage                  com.google.firebase:firebase-storage:12.0.0
Crash Reporting          com.google.firebase:firebase-crash:12.0.0  
Authentication           com.google.firebase:firebase-auth:12.0.0    
Cloud Messaging          com.google.firebase:firebase-messaging:12.0.0 
Remote Config            com.google.firebase:firebase-config:12.0.0  
Invites and 
Dynamic Links            com.google.firebase:firebase-invites:12.0.0 
AdMob                    com.google.firebase:firebase-ads:12.0.0 
App Indexing             com.google.firebase:firebase-appindexing:12.0.0 
Performance Monitoring   com.google.firebase:firebase-perf:12.0.0   
编辑 以上版本已被弃用。它们使用单独的版本控制。请参阅下面的链接

谷歌播放服务-

Firebase-

这是因为play services包含许多依赖项。。看这里。。选择要使用的任何依赖项,而不是全部使用。@ZeroOne很酷。谢谢你的快速回复。你能给这个问题加一个答案吗?我不知道。当我浏览了一些教程,并没有意识到运行Gradle时这有多么糟糕。我很高兴在我的项目早期就发现了这一点;在阅读了ZeroOne的评论后,我删除了Gradle中的:implementation'com.google.android.gms:play services:12.0.1',然后APK的发行量减少了3MB。。谢谢,谷歌云信息被贬值了。改用Firebase按摩。@ZeroOne…如何获取所有依赖项的最新版本?
Firebase API                Description in build.gradle

Analytics                com.google.firebase:firebase-core:12.0.0
Realtime Database        com.google.firebase:firebase-database:12.0.0    
Cloud Firestore          com.google.firebase:firebase-firestore:12.0.0   
Storage                  com.google.firebase:firebase-storage:12.0.0
Crash Reporting          com.google.firebase:firebase-crash:12.0.0  
Authentication           com.google.firebase:firebase-auth:12.0.0    
Cloud Messaging          com.google.firebase:firebase-messaging:12.0.0 
Remote Config            com.google.firebase:firebase-config:12.0.0  
Invites and 
Dynamic Links            com.google.firebase:firebase-invites:12.0.0 
AdMob                    com.google.firebase:firebase-ads:12.0.0 
App Indexing             com.google.firebase:firebase-appindexing:12.0.0 
Performance Monitoring   com.google.firebase:firebase-perf:12.0.0