title: Run Time Error : java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
body: <pre><code>// MyActivity.class 
  
  package com.example.maps;
  
  import android.app.Activity;
  import android.os.Bundle;
  
  public class MyActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
      }
  }
  
  // main.xml
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/map"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:name="com.google.android.gms.maps.MapFragment"/&gt;
  
  // AndoidManifest.xml
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
            package="com.example.maps"
            android:versionCode="1"
            android:versionName="1.0"&gt;
      &lt;uses-sdk android:minSdkVersion="15"/&gt;
      &lt;application android:label="@string/app_name" android:icon="@drawable/ic_launcher"&gt;
          &lt;activity android:name="MyActivity"
                    android:label="@string/app_name"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN"/&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <ol>
  <li>Compilation - no error</li>
  <li>Runtime Error is there.</li>
  <li>Added google services jar to lib as well as modules </li>
  <li>using intellij idea</li>
  <li>Took this code from google website </li>
  <li>Also took reference from android developers</li>
  </ol>
  
  <p>Below is my error :</p>
  
  <pre><code>java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable 
  at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
  at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
  at android.app.Activity.onCreateView(Activity.java:4247)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:673)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:268)
  at android.app.Activity.setContentView(Activity.java:1837)
  at com.example.maps.MyActivity.onCreate(MyActivity.java:11)
  at android.app.Activity.performCreate(Activity.java:4470)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
  at android.app.ActivityThread.access$600(ActivityThread.java:123)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:4424)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>