NoClassDefFoundError with Mapsforge 0.4.0 and Eclipse

前端 未结 2 1505
南方客
南方客 2021-01-15 02:33

I am trying to add a map view to my application using Mapsforge. I have done the following:

  • Downloaded jar files and placed them in the libs/ fold
相关标签:
2条回答
  • 2021-01-15 03:02

    @Ninja pointed me in the right direction but I'll post the detailed steps here.

    Short answer: You need version 19 or higher of the Android toolchain, as that version introduced the Java 7 support needed to build against the prebuilt Mapsforge 0.4.0 libraries.

    How to update:

    • Start ADT. Update all installed packages and additionally select at least one version of Android SDK Build-tools that is 19 or higher. (You can have multiple versions of the Android SDK Build-tools installed alongside each other.)
    • Now open Eclipse and select Help > Check for Updates from the menu.
      • If you get an error message that no software sources are available, go to Help > Install new software. In the dialog, click Add and add a new repository named ADT Plugin, URL https://dl-ssl.google.com/android/eclipse/. Then retry.
    • Restart Eclipse when prompted to do so.
    • Setting the compiler compliance level turned out not to be necessary in my case (I left it at 1.6).

    With these steps my Mapsforge project works – I can display a map and the NoClassDefFoundError is gone.

    0 讨论(0)
  • 2021-01-15 03:11

    NoClassDefFound is really a hard Exception to solve,a workaround you can try.

    workaroud: Java Build Path -> Oeder and Export -> make sur 3rd.jar above yourPath/src

    I know android support java7, only when you use the version above 19.

    0 讨论(0)
提交回复
热议问题