我有一个非常简单的布局文件,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!-- put map fragment here -->
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment">
</fragment>
</LinearLayout>
然后,我有一个扩展FragmentActivity的类,就像这样开始:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map_view);
当它遇到setContentView时,我得到一个运行时异常。我无法弄清楚原因。
添加了:
好吧,我不包括onCreate的其余部分,因为它永远不会到达它。 logcat的相关部分似乎是:
05-09 22:31:35.604:E / dalvikvm(922):找不到上课 'com.google.android.gms.maps.model.MarkerOptions',引用自 方法com.molavi.homeworkfive.LocalMap.setUpMap 05-09 22:31:35.604: W / dalvikvm(922):VFY:无法解析新实例470 (Lcom / google / android / gms / maps / model / MarkerOptions;)in LCOM /穆拉维/ homeworkfive / LocalMap; 05-09 22:31:35.635: D / dalvikvm(922):VFY:在0x0002 05-09处替换操作码0x22 22:31:35.744:E / dalvikvm(922):找不到上课 'com.google.android.gms.maps.MapView',从方法引用 com.molavi.homeworkfive.LocalMap.setUpMapIfNeeded 05-09 22:31:35.744: W / dalvikvm(922):VFY:无法解决check-cast 466 (Lcom / google / android / gms / maps / MapView;)中 LCOM /穆拉维/ homeworkfive / LocalMap; 05-09 22:31:35.744: D / dalvikvm(922):VFY:将代码0x1f替换为0x000b 05-09 22:31:35.754:E / dalvikvm(922):找不到上课 'com.google.android.gms.maps.SupportMapFragment',引用自 方法com.molavi.homeworkfive.LocalMap.onCreate 05-09 22:31:35.764: W / dalvikvm(922):VFY:无法解决check-cast 467 (Lcom / google / android / gms / maps / SupportMapFragment;)中 LCOM /穆拉维/ homeworkfive / LocalMap; 05-09 22:31:35.784: D / dalvikvm(922):VFY:替换操作码0x1f在0x003f 05-09 22:31:35.814:I / dalvikvm(922):找不到方法 com.google.android.gms.maps.SupportMapFragment.onDestroy,引用 来自方法com.molavi.homeworkfive.LocalMap.onDestroy 05-09 22:31:35.814:W / dalvikvm(922):VFY:无法解析虚方法 3401:Lcom / google / android / gms / maps / SupportMapFragment; .onDestroy()V 05-09 22:31:35.814:D / dalvikvm(922):VFY:替换操作码0x6e at 0x0002 05-09 22:31:35.856:I / dalvikvm(922):找不到方法 com.google.android.gms.maps.SupportMapFragment.onLowMemory,引用 来自方法com.molavi.homeworkfive.LocalMap.onLowMemory 05-09 22:31:35.864:W / dalvikvm(922):VFY:无法解析虚方法 3402:Lcom / google / android / gms / maps / SupportMapFragment; .onLowMemory()V 05-09 22:31:35.864:D / dalvikvm(922):VFY:替换操作码0x6e at 0x0005 05-09 22:31:35.904:I / dalvikvm(922):找不到方法 com.google.android.gms.maps.SupportMapFragment.onPause,引用 来自方法com.molavi.homeworkfive.LocalMap.onPause 05-09 22:31:35.904:W / dalvikvm(922):VFY:无法解析虚方法 3403:Lcom / google / android / gms / maps / SupportMapFragment; .onPause()V 05-09 22:31:35.934:D / dalvikvm(922):VFY:替换操作码0x6e at 0x0002 05-09 22:31:35.944:I / dalvikvm(922):找不到方法 com.google.android.gms.maps.SupportMapFragment.onResume,引用 来自方法com.molavi.homeworkfive.LocalMap.onResume 05-09 22:31:35.964:W / dalvikvm(922):VFY:无法解析虚方法 3404:Lcom / google / android / gms / maps / SupportMapFragment; .onResume()V 05-09 22:31:35.964:D / dalvikvm(922):VFY:替换操作码0x6e at 0x0005 05-09 22:31:35.984:I / dalvikvm(922):找不到方法 com.google.android.gms.maps.SupportMapFragment.onSaveInstanceState, 从方法中引用 com.molavi.homeworkfive.LocalMap.onSaveInstanceState 05-09 22:31:35.984:W / dalvikvm(922):VFY:无法解析虚方法 3405: LCOM /谷歌/机器人/克/地图/ SupportMapFragment; .onSaveInstanceState (Landroid / os / Bundle;)V 05-09 22:31:36.014:D / dalvikvm(922):VFY: 替换操作码0x6e在0x0005 05-09 22:31:36.024:D / dalvikvm(922): DexOpt:无法选择在0x04处直接调用0x0d4f Lcom / molavi / homeworkfive / LocalMap; .setUpMap 05-09 22:31:36.044: D / dalvikvm(922):DexOpt:无法选择在0x15处直接调用0x0d4e Lcom / molavi / homeworkfive / LocalMap; .setUpMap 05-09 22:31:37.464: E / ThrottleService(287):onPollAlarm期间出现问题: java.lang.IllegalStateException:解析统计信息的问题: java.io.FileNotFoundException:/ proc / net / xt_qtaguid / iface_stat_all: 打开失败:ENOENT(没有这样的文件或目录)
但是我没有得到它,因为它似乎说它找不到mapFragment上的方法,但mapFragment肯定有这些方法。