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 8692837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:24:13+00:00 2026-06-13T00:24:13+00:00

Hi Everyone I am using the code given here What is the simplest and

  • 0

Hi Everyone I am using the code given here What is the simplest and most robust way to get the user's current location on Android? to get current location But I am getting the ClassNotFoundExecption Here is my complete code:

//MapActivity code:

package com.example.gmaps;
import com.example.gmaps.MyLocation.LocationResult;
import com.google.android.maps.MapActivity;
import android.location.Location;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Toast;

public class MainActivity extends MapActivity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    LocationResult locationResult = new LocationResult(){
        @Override
        public void gotLocation(Location location){
            //Got the location!

            Toast.makeText(getApplicationContext(), "I got the location", Toast.LENGTH_LONG).show();
        }
    };
    MyLocation myLocation = new MyLocation();
    myLocation.getLocation(MainActivity.this, locationResult);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}

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

}

ANd in MyLocation I have same code as given in above link
Here is my logcat

> 10-18 16:49:51.222: E/AndroidRuntime(24816): FATAL EXCEPTION: main
10-18 16:49:51.222: E/AndroidRuntime(24816): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.gmaps/com.example.gmaps.MainActivity}: java.lang.ClassNotFoundException: com.example.gmaps.MainActivity
10-18 16:49:51.222: E/AndroidRuntime(24816):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1993)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at android.app.ActivityThread.access$600(ActivityThread.java:132)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1157)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at android.os.Handler.dispatchMessage(Handler.java:99)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at android.os.Looper.loop(Looper.java:137)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at android.app.ActivityThread.main(ActivityThread.java:4575)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at java.lang.reflect.Method.invokeNative(Native Method)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at java.lang.reflect.Method.invoke(Method.java:511)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at dalvik.system.NativeStart.main(Native Method)
10-18 16:49:51.222: E/AndroidRuntime(24816): Caused by: java.lang.ClassNotFoundException: com.example.gmaps.MainActivity
10-18 16:49:51.222: E/AndroidRuntime(24816):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
10-18 16:49:51.222: E/AndroidRuntime(24816):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1984)
10-18 16:49:51.222: E/AndroidRuntime(24816):    ... 11 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-13T00:24:15+00:00Added an answer on June 13, 2026 at 12:24 am

    Did you add above code your AndroidManifest.xml ?

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

    You must add this code between application tag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

everyone. This is a piece of code from using sqlite in android tutorial: return
Hello everyone my problem is very simple. Using entity framework code first I want
Hey everyone. The following is the code that I am using to play random
everyone. I'm having a memory allocation error using ctypes and a C code. I'm
It must be the most common function for what everyone has a code snippet
Hi everyone I am currently using the below code to run ajax submission on
Hi everyone I was using the jQuery form plugin to process form submission (found
Greetings everyone! I programmed GUI Application using Java Swing under Windows. Under windows everything
Hey everyone, I want to start using Scheme and I have two questions. First,
Good day everyone, I am building a page in ASP.NET, and using Master Pages

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.