Google Maps Android v2 not working with ActionBarSherlock Fragment Activity

♀尐吖头ヾ 提交于 2019-12-05 16:20:20

Did you include the full source from the Google Maps library? There are resources there (hence the reference to java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)).

It's not enough to just reference the google-play-services.jar file. Double check the README.txt file at the root of the Google Play Services project.

Found same issue on my project.
Solution is to add 2 dependencies for com.google.android.gms both apklib and jar to maven build script:

    <!-- google-play-services. -->
    <dependency>
        <groupId>com.google.android.gms</groupId>
        <artifactId>google-play-services</artifactId>
        <version>4</version>
        <type>apklib</type>
    </dependency>

    <dependency>
        <groupId>com.google.android.gms</groupId>
        <artifactId>google-play-services</artifactId>
        <version>4</version>
        <type>jar</type>
    </dependency>

Also, dependency com.google.android.maps not needed for maps v2.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!