Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9121037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:46:06+00:00 2026-06-17T05:46:06+00:00

Can anyone clarify where my error is? The Android app crashes with the error,

  • 0

Can anyone clarify where my error is? The Android app crashes with the error, “Unfortunately, my app has stopped working”. The crash only happens when my activity_main.xml contains android:id="@+id/map":

<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/map"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  class="com.google.android.gms.maps.MapFragment"/>

My MainActivity.java class is equally simple:

public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

I have added the “google-play” dependencies and I am targeting “Google APIs”. Again, the app runs fine when I do not attempt to display the map.

Here are the LogCat Errors:

01-11 02:04:24.608: E/AndroidRuntime(14416): FATAL EXCEPTION: main
01-11 02:04:24.608: E/AndroidRuntime(14416): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.myfirstapp/com.example.myfirstapp.MainActivity}: java.lang.ClassNotFoundException: com.example.myfirstapp.MainActivity
01-11 02:04:24.608: E/AndroidRuntime(14416):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at android.app.ActivityThread.access$600(ActivityThread.java:151)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1331)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at android.os.Looper.loop(Looper.java:155)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at android.app.ActivityThread.main(ActivityThread.java:5485)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at java.lang.reflect.Method.invokeNative(Native Method)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at java.lang.reflect.Method.invoke(Method.java:511)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:795)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at dalvik.system.NativeStart.main(Native Method)
01-11 02:04:24.608: E/AndroidRuntime(14416): Caused by: java.lang.ClassNotFoundException: com.example.myfirstapp.MainActivity
01-11 02:04:24.608: E/AndroidRuntime(14416):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at android.app.Instrumentation.newActivity(Instrumentation.java:1069)
01-11 02:04:24.608: E/AndroidRuntime(14416):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2258)
01-11 02:04:24.608: E/AndroidRuntime(14416):    ... 11 more

Updated
And here is the manifest

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

    <!-- MAPS -->
    <permission android:name="com.example.myfirstapp.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
    <uses-permission android:name="com.example.myfirstapp.permission.MAPS_RECEIVE"/>

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

    <!-- Allows the API to access Google web-based services -->
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>

    <!-- External storage for caching. -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    <!-- My Location -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

    <!-- Maps API needs OpenGL ES 2.0. -->
    <uses-feature
      android:glEsVersion="0x00020000"
      android:required="true"/>
    <!-- 8/17 oneX=16-->
    <uses-sdk
        android:minSdkVersion="12" 
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <!-- REMOVED user-library android:name="com.google.android.maps" / -->

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

        <activity
            android:name="com.example.myfirstapp.MainActivity"
            android:label="@string/app_name" >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

UDPATED New LogCat since changing android:minSdkVersion=”12″ “Use MapFragment only if you are targeting API 12 and above. Otherwise, use SupportMapFragment.”

01-11 11:26:23.267: E/AndroidRuntime(27646): FATAL EXCEPTION: main
01-11 11:26:23.267: E/AndroidRuntime(27646): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myfirstapp/com.example.myfirstapp.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2351)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.ActivityThread.access$600(ActivityThread.java:151)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1331)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.os.Handler.dispatchMessage(Handler.java:99)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.os.Looper.loop(Looper.java:155)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.ActivityThread.main(ActivityThread.java:5485)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at java.lang.reflect.Method.invokeNative(Native Method)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at java.lang.reflect.Method.invoke(Method.java:511)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:795)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at dalvik.system.NativeStart.main(Native Method)
01-11 11:26:23.267: E/AndroidRuntime(27646): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:358)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.Activity.setContentView(Activity.java:1912)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at com.example.myfirstapp.MainActivity.onCreate(MainActivity.java:12)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.Activity.performCreate(Activity.java:5066)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1101)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
01-11 11:26:23.267: E/AndroidRuntime(27646):    ... 11 more
01-11 11:26:23.267: E/AndroidRuntime(27646): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.MapFragment: make sure class name exists, is public, and has an empty constructor that is public
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.Fragment.instantiate(Fragment.java:624)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.Fragment.instantiate(Fragment.java:584)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.Activity.onCreateView(Activity.java:4714)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
01-11 11:26:23.267: E/AndroidRuntime(27646):    ... 21 more
01-11 11:26:23.267: E/AndroidRuntime(27646): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
01-11 11:26:23.267: E/AndroidRuntime(27646):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-11 11:26:23.267: E/AndroidRuntime(27646):    at android.app.Fragment.instantiate(Fragment.java:606)
01-11 11:26:23.267: E/AndroidRuntime(27646):    ... 24 more       
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:46:07+00:00Added an answer on June 17, 2026 at 5:46 am

    It is required to use SupportMapFragment if API version is below 11

    <fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment"/>
    
    • Don’t forget to extend your Activity with FragmentActivity

      public class MainActivity extends FragmentActivity{
      
      SupportMapFragment mMap;
      GoogleMap googleMap;
      
        @Override
       protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      
             mMap = (SupportMapFragment) getSupportFragmentManager()
              .findFragmentById(R.id.map);
      
              googleMap = mMap.getMap();
       }
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone tell me why this code would not be working? $('body').on('test', function() {
Can anyone just clarify this for me, I was under the impression that to
Has anyone tried using uWSGI with Cherokee? Can you share your experiences and what
Can anyone clarify how we can use in general, or a in real world
Can anyone clarify some things things for me. If I go back a previous
For some reason this SQL statement is not working. Can anyone tell me why?
Can anyone let me know how can we change the value of kendo combobox
Can anyone enlighten me to a way I can Highlight the content of an
Can anyone explain to me why this program: for(float i = -1; i <
Can anyone help - this is driving me mad. I am calling a mysql

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.