0

I'm developing an application using Google Maps. It references the Google Map Util library project, which references google play services library and appcompat-v7. Here is my workspace:

https://www.dropbox.com/s/cwy2o9di7bk74li/Zrzut%20ekranu%202014-12-14%2016.21.07.png?dl=0

And yet, if I try to compile and run the application, it instantly crashes, with the following trace:

12-14 16:14:24.063: E/AndroidRuntime(7592): FATAL EXCEPTION: main
12-14 16:14:24.063: E/AndroidRuntime(7592): java.lang.NoClassDefFoundError: com.google.android.gms.maps.model.LatLng
12-14 16:14:24.063: E/AndroidRuntime(7592):     at michal.myapp.activities.StartupScreenActivity.onCreate(StartupScreenActivity.java:36)

So apparently the compiler has trouble finding google play services jars. Any ideas?

Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="michal.myapp"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="21" />

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCELEROMETER"/>
<uses-permission android:name="android.permission.CAMERA" />


<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true"/>

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="michal.myapp.activities.MapActivity"
        android:label="@string/app_name" >            
    </activity>

    <activity
        android:name="michal.myapp.activities.StartupScreenActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity android:name="michal.myapp.activities.CameraActivity"
      android:label="@string/app_name"

      android:screenOrientation="portrait">
      <!-- configure this activity to use landscape orientation -->


    </activity>

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="@string/api_key"/>

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

</application>

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Plus, checked the class folders, and they do exist at the locations pointed in the Manifest. Okay, I added back Android Private Libraries to the build path (removed them because I had JAR mismatches because of it), but now it seems to work. I'll mark the answer as correct.

user4359659
  • 149
  • 2
  • 4
  • 18
  • possible duplicate of [Android Explicit Intent throws NoClassDefFound error](http://stackoverflow.com/questions/5848769/android-explicit-intent-throws-noclassdeffound-error) – 323go Dec 14 '14 at 15:35
  • No, it's not. I have a different Manifest file (which I'll add in a sec). – user4359659 Dec 14 '14 at 15:38

1 Answers1

0

You must follow the oficial steps by Google to nice configuration of library : https://developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api

Mou
  • 2,027
  • 1
  • 18
  • 29