我试图在我的应用程序中用 osmdroid 替换谷歌地图,所以在其他小的代码更改中,我更改了我替换的 main.xml:
<com.google.android.maps.MapView
android:id="@+id/mapmain"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:apiKey="0Me4thQTjI4jtNE1Wv51g4KNSNiojinUXncwJ6g"
android:layout_below="@+id/filterbar"
/>
和:
<org.osmdroid.views.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/mapmain"
></org.osmdroid.views.MapView>
现在我得到一个运行时异常:
07-27 12:50:29.264: ERROR/AndroidRuntime(488): FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at java.lang.Class.getDeclaredConstructors(Native Method)
at java.lang.Class.getConstructor(Class.java:477)
at android.view.LayoutInflater.createView(LayoutInflater.java:475)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
at android.app.Activity.setContentView(Activity.java:1647)
at com.rushme.RMMapActivity.onCreate(RMMapActivity.java:60)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: org.slf4j.LoggerFactory
at org.osmdroid.views.MapView.<clinit>(MapView.java:64)
... 24 more
谁能告诉我我做错了什么?