【发布时间】:2013-01-24 14:03:16
【问题描述】:
今天看了Google Maps Android API v2的文档,说android-sdk\extras\google\google_play_services\samples\maps的项目可以运行,
但是在我导入eclipse并正确设置android-support-v4.jar和google-play-services.jar的库后,FeatureView.java中的import com.example.mapdemo.R;(第24行)找不到文件R.java.
com.example.mapdemo中几乎所有的java文件都需要类“R”,例如文件BasicMapActivity.java在第41行“setContentView(R.layout.basic_demo);”和第71行mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();”需要R
谁能告诉我如何找到“R”类?
R
.java can not create automatically because the file multimap_demo.xml have some errors in
<br><br> <fragment
<br> android:id="@+id/map3"
<br> android:layout_width="match_parent"
<br> android:layout_height="match_parent"
<br> android:layout_weight="0.5"
<br> class="com.google.android.gms.maps.SupportMapFragment"
<br> map:cameraTargetLat="48.85"
<br> map:cameraTargetLng="2.35"
<br> map:cameraZoom="8"/>
<br><br>
eclipse 说“cameraTargetLat”、“cameraTargetLng”和“cameraZoom”无法识别。 错误信息:
Multiple annotations found at this line:
- error: No resource identifier found for attribute 'cameraTargetLat' in package 'com.example.mapdemo'
- error: No resource identifier found for attribute 'cameraTargetLng' in package 'com.example.mapdemo'
- error: No resource identifier found for attribute 'cameraZoom' in package 'com.example.mapdemo'
I do not know why.
If I change the code like this:
<br><br> <fragment
<br> android:id="@+id/map3"
<br> android:layout_width="match_parent"
<br> android:layout_height="match_parent"
<br> android:layout_weight="0.5"
<br> class="com.google.android.gms.maps.SupportMapFragment"/>
<br><br>
错误消失了,但我不知道它是否可以运行。
【问题讨论】: