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

  • Home
  • SEARCH
  • 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 6997319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:16:07+00:00 2026-05-27T20:16:07+00:00

I have seen this thread ClassNotFoundException Thrown using MapView but no help for me.

  • 0

I have seen this thread

ClassNotFoundException Thrown using MapView
but no help for me.

The code im my manifest file is :

<uses-sdk android:minSdkVersion="10" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />

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

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".GoogleMapsGpsActivity"
        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>

and my code for GoogleMapsGpsActivity.java is :

public class GoogleMapsGpsActivity extends MapActivity {
    private LocationManager lm;
    private LocationListener locationListener;

    private MapView mapView;
    private MapController mc;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main); 

        //---use the LocationManager class to obtain GPS locations---
        lm = (LocationManager) 
            getSystemService(Context.LOCATION_SERVICE);    

        locationListener = new MyLocationListener();

        lm.requestLocationUpdates(
            LocationManager.GPS_PROVIDER, 
            0, 
            0, 
            locationListener);

        mapView = (MapView) findViewById(R.id.mapview);
        mc = mapView.getController();

    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }        

    private class MyLocationListener implements LocationListener 
    {
        @Override
        public void onLocationChanged(Location loc) {
            if (loc != null) {                
                Toast.makeText(getBaseContext(), 
                    "Location changed : Lat: " + loc.getLatitude() + 
                    " Lng: " + loc.getLongitude(), 
                    5000).show();

                GeoPoint p = new GeoPoint(
                        (int) (loc.getLatitude() * 1E6), 
                        (int) (loc.getLongitude() * 1E6));
                mc.animateTo(p);
                mc.setZoom(16);                
                mapView.invalidate();
            }
        }

        @Override
        public void onProviderDisabled(String provider) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onProviderEnabled(String provider) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onStatusChanged(String provider, int status, 
            Bundle extras) {
            // TODO Auto-generated method stub
        }
    }  
}

main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mainlayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <com.googlemaps.gpsapp.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="key"
    />
</LinearLayout>

and I am getting ClassNotFoundException as can be seen from following logcat output

1-02 12:44:17.156: E/AndroidRuntime(1585): FATAL EXCEPTION: main
01-02 12:44:17.156: E/AndroidRuntime(1585): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.googlemaps.gpsapp/com.googlemaps.gpsapp.GoogleMapsGpsActivity}: java.lang.ClassNotFoundException: com.googlemaps.gpsapp.GoogleMapsGpsActivity in loader dalvik.system.PathClassLoader[/data/app/com.googlemaps.gpsapp-2.apk]
01-02 12:44:17.156: E/AndroidRuntime(1585):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at android.os.Looper.loop(Looper.java:130)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at android.app.ActivityThread.main(ActivityThread.java:3683)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at java.lang.reflect.Method.invokeNative(Native Method)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at java.lang.reflect.Method.invoke(Method.java:507)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at dalvik.system.NativeStart.main(Native Method)
01-02 12:44:17.156: E/AndroidRuntime(1585): Caused by: java.lang.ClassNotFoundException: com.googlemaps.gpsapp.GoogleMapsGpsActivity in loader dalvik.system.PathClassLoader[/data/app/com.googlemaps.gpsapp-2.apk]
01-02 12:44:17.156: E/AndroidRuntime(1585):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-02 12:44:17.156: E/AndroidRuntime(1585):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
01-02 12:44:17.156: E/AndroidRuntime(1585):     ... 11 more

Please point out my mistake

Edit

Thank u everybody for their responses the error was in my main.xml in declaring mapview

it should be like

<com.google.android.maps.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="key"
    />

instead of the one posted above.

  • 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-05-27T20:16:08+00:00Added an answer on May 27, 2026 at 8:16 pm

    Just keep in mind that you need to declare <uses-library> tag inside the <application> tag.

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

    Final soluton:

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
    
    <uses-library android:name="com.google.android.maps" > </uses-library>
    // This should be here
    
        <activity
            android:name=".GoogleMapsGpsActivity"
            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>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen this thread: WPF image resources and applied the information there. But
I have seen this macro defined before but never really knew its purpose. Can
I have seen this syntax in MSDN: yield break , but I don't know
I have seen this question about deploying to WebSphere using the WAS ant tasks.
Apologies in advance but I have never seen this error before and don't know
I have seen this thread on how to execute terminal commands from within a
(Note: I have seen this question and it uses a cursor not an animation.)
I have seen the solution for this problem in this thread -> How to
Ok, firstly I've seen this thread . But none of the solutions are very
I have only seen code solutions to this problem. I am looking for a

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.