Adding Google-Play-Services to library project

喜你入骨 提交于 2019-12-10 09:42:58

问题


I'm working on a map library and I'm using Google-Play-Services. So Far so good. Problem is this:

  1. I include Google-Play-Services library project in my map library (using: properties -> android -> add library). Tested it using a client within the library (Unchcecking the library checkbox and launching a mainActivity) and works fine!
  2. When I include my map library in a sample client project, this client project won't have access to Google Play Services, why? If I include Google play services in the client project, I get:

    [2013-07-18 08:40:04 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/android/gms/R$attr;

    [2013-07-18 08:40:04 - maps-sample-android] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/android/gms/R$attr;

Android won´t let include Google Play Services on my own or use it from my library project, is there any way to solve this?


回答1:


[2013-07-18 08:40:04 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/android/gms/R$attr;

[2013-07-18 08:40:04 - maps-sample-android] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/android/gms/R$attr;

These errors suggest that you have 2 different jar files which are both trying to declare the same variable. Perhaps you have 2 different versions of the google-play-services?




回答2:


In your library project properties in the java build path (order and export tab) make sure that the Android dependancies box is ticked.

This will allow the library project to export the google play library with it.

You will then not need to add a reference to google play in the client project.



来源:https://stackoverflow.com/questions/17724808/adding-google-play-services-to-library-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!