我正在开展一个我想要显示地图的项目,因为我想添加google-play-service-lib
但是当我添加它时,我的R.java
文件会被删除而不会重新生成。
我尝试在构建路径中添加google-play-service-lib
。添加后一切顺利。但是,当我运行项目时,它会给出一个错误,java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
当我将其添加到项目中时,R.java
会被删除。我尝试了在google
和SO
上找到的多种排列和组合。但是没有可行的解决方案,这解决了我的问题。
请帮帮我.. !!
修改
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<fragment
android:id="@+id/map_gle"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
答案 0 :(得分:0)
确保您的Google Play服务存在于同一工作目录中,并将此项目作为对原始项目的引用。
Ensure you have the latest version (v2) of the Google Play Services installed.
Select Window > Android SDK Manager or run android at the command line.
Scroll to the bottom of the package list and select Extras > Google Play services. The Google Play services SDK is downloaded to your computer and installed in your Android SDK environment at <android-sdk-folder>/extras/google/google_play_services/
Add the Google Play Services project into your Eclipse workspace.
Click File -> Import..., select Android -> Existing Android Code into Workspace
Browse to and select <android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib
To add the dependency to Google Play Services into your project
Project -> Properties -> Android -> Library, Add -> google-play-services_lib
提供link您可以看到导入的Google Play服务
甚至可以通过访问sdk manger来检查您的Google Play服务是否是最新的...