Im trying to replace google maps with osmdroid in my application so amongst other small code changes I changed the main.xml I've replaced:
<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"
/>
with:
<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>
now I get a runtime exception:
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
Can anybody tell me what I'm doing wrong ?
精彩评论