Cannot resolve MapActivity class on Android

后端 未结 12 2484
刺人心
刺人心 2020-11-29 09:48

I have an application which has 11 different activities. One of these activities is an extension of MapActivity (it is a map for data visualization). To get to this activi

相关标签:
12条回答
  • 2020-11-29 10:24

    For those who are using Android studio and gradle:

    1. Completely remove maps.jar (and any other libs added for google maps) from dependencies.
    2. In your projects manifest and in your maps-library (if you are using one) module add this line in 'application' section:

      < uses-library android:name="com.google.android.maps" />

    3. In your projects build.gradle file (and also in maps library gradle if you are using one) modify compileSdkVersion:

      compileSdkVersion "Google Inc.:Google APIs:19"

    4. Clean and rebuild your project.

    0 讨论(0)
  • 2020-11-29 10:27

    Apparently at some point my build environment got really messed up. It looked like I somehow had the google APIs jar in my project twice, causing a conflict. I deleted the project and recreated it, works now.

    0 讨论(0)
  • 2020-11-29 10:28

    I had the same problem and I realized you cannot just add the map library to the project, you have to change the target to something like this target=Google Inc.:Google APIs:8 instead of android=android-8.

    Anyway thanks you gave me the hint to discover it ;)

    0 讨论(0)
  • 2020-11-29 10:31

    try this:

    on your Android .jar right click Build Path-> Configure Build Path. then if you see 2 maps.jar includes remove one of them...

    0 讨论(0)
  • 2020-11-29 10:31

    in my case it turned out that the maps.jar was also sitting in my libs directory. Removing it from that fixed the issue.

    0 讨论(0)
  • 2020-11-29 10:36

    @cyber-monk's (sorry, can't comment on answers yet) answer is similar to every other answer on the internet, except that it shows one very important detail that most leave out. You have to put the tag within the tag. Most just say to put it in the manifest without saying WHERE to put it. I put it inside and finally, FINALLY got it to work

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