Development issue/problem:

I’m trying to make the Google Maps PI v2 android code example work. I receive a project without error. However, if I try to run the application on my Galaxy Nexus (connected to my laptop via USB), the application crashes instantly.

It’s registered:

Cannot find the class Lcom/example/sample/folder/BasicMapActivity; (66)Cannot find the class com.example.mapdemo.basicMapActivity referenced in the com.mapdemo.mainActivity method.
VFY: cannot solve const class 108 (Lcom/example/demonstration/mapping base activity;) to Lcom/example/demonstration/mapping base activity;
VFY : Replace opcode 0x1c with 0x000d
Ljava/lang/NoClassDefFoundError exception; started when initializing Lcom/example/update;
class does not work when calling newInstance (Lcom/example/update;)
VM switch-off
threadid=1 : Finish the thread with the exception not captured (Group=0x41ac9930)
FATAL EXCEPTION: head
java.lang.ExceptionInitializerError
at java.lang.Class.newInstanceImpl (Native Method)
at java.lang.Class.newInstance (Class.java: 1319)
at android.app.Instrumentation.newActivity.java: 1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
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:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Cause: java.lang.NoClassDefFoundError: com.example.mapdemo.BasicMapActivity
on com.example.mapdemo.MainActivity(MainActivity.java:97)
. 15 more details

Does anyone have any advice for me on how to solve this problem or what I can do wrong?

How can I solve this problem?

Solution 1:

Be very, very careful with the fraud form:
https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw.

In particular, I think you’ll need

  • Import the real source code of the google-play-services_lib project and link it as an Android library.
    • Do it via Project -> Properties -> Android -> Library, Add -> google-play-services_lib (you can right click on your project and select Properties, and then select Android).
    • Don’t add it as a dependent project via the Java Build Path for your project, it didn’t work for me.
  • Add google-play-services.jar and android-support v4.jar to the libs folder of the example project and add them as external JARs under Build Path -> Configure Build Path -> Libraries.

I found this second step necessary because I had exactly the same mistake as you when I tried to use the example code. The first step was necessary to avoid the NoClassDefFoundError in com.google.android.gms.R$styleable in my current project.

I also had to do a clean build and remove the application from the device (from a previous test attempt) before the sample code worked.

Solution 2:

Follow Google’s instructions in the example code below.

Skip section 4 and follow the instructions below:

  • Add a new folder named libs to your project.
  • Copy the form Google-play-services.jar :

Android sdk-folderextrasgooglegoogle_serviceslibprojectgoogle-play-services_liblibs

in the libs folder -> right click on this pot in this folder -> Build Path -> Add Path to build Path.

  • android v4.jar support form :

android-sdk-folderextrasandroidsupportv4

in the libs folder -> right click on this pot in this folder -> Build Path -> Add Path to build Path.

Where the folder on the android disk is normally located: C:UsersUsers_nameandroid-sdks

Solution 3:

I had the same problem, I solved it like this.

  1. Go to Project Properties.
  2. Select the Java building path
  3. Choose the Order and Export tab
  4. Here you should see the paths and dependencies of the selected src and gene project.

The order in which they are listed was first src and then gen-pad I change it so that the gen folder is collected for src.

CLICK on each of the items listed.

You know what I mean:
NoClassDefFoundError for code in the Java library on Android

Solution 4:

This is due to a lot of confusion about the input plans. Documents
https://developers.google.com/maps/documentation/android/intro#sample_code
states that you should never select Copy Projects in the workspace. Do not select this option for playing services and rehearsals – leave them where they are.

After input, check the following:

  1. Right-click on the MainActivity project and select Properties
  2. Go to Android and make sure you see the green check mark next to google play services-lib
    (the play services-lib should never be added as such – it should rather be added as an Android library).
  3. Go to the Java build path and import the external pot ( android-support-v4.jar) in the libraries section.
  4. [IMPORTANT] In the Java building path, go to Order and Export and make sure there is a checkmark at androidpod v4.jar (this does not happen by default and therefore you will see the error mentioned above).
  5. Make sure you clean up and rebuild the project after the changes, so you don’t try to fix something that works but hasn’t been pushed.

Solution No 5:

  1. Follow the instructions on the Google code.
  2. And define the java building path as follows: .

Solution No 6:

I had the same problem and I couldn’t solve it. Eventually I took the sample project file from the other machine, copied it to mine and downloaded the new project I got from the other machine. Then everything will be all right. I tried to find the problem by comparing two projects in the sample, but failed. Anyway, the new samples I took from the other machine are working fine.

Solution No 7:

I had the same problem.
The import-summary.txt file had an answer.
In my case I imported the Eclipse project with a space in the path. That’s a problem with the wizard.
Create a new path. Project reimported. Then the Build/Rebuild project.
It’s no problem.

Solution No 8:

  1. Try the same sample code in a new workspace.
  2. You can also copy the example map and the Google Play Services library project (/extras/google/google_play_services/libproject/google-play-services_lib) and paste it into the new workspace.
  3. Then don’t forget to add the jar ORDER with SDK. (android-support-v4.jar can be found in /extras/android/compatibility/v4/android-support-v4.jar in directory
    android-sdk).

Good luck!

how to crash android app manually,android studio app crashes without error,how to crash android phone permanently,android studio app keeps stopping in emulator,how to fix crash using logcat in android mcq,android studio app crashes on button click,google maps android release notes,google map integration in android 2019,google maps-services latest version,play services location release notes,android google maps,setscrollgesturesenabledduringrotateorzoom,google maps version history,google maps sdk android,maps sdk 3 beta,maps v3 beta,google map configuration in android,google maps api version history,google play may remove support for version 1 of the google maps sdk in the future.,latest google map api version android,google maps sdk version,google maps release notes

You May Also Like

10 Best Laptop for Accounting Students | laptops for quickbooks

As a designer, draftsman or mechanical and structural engineer, you must be…

6 Best Cloud Web Hosting Providers In 2021

Looking for the best cloud hosting providers? If that’s the case, you’re…

20 best CCleaner alternatives to boost up your PC in 2020

CCleaner is an excellent program to remove unnecessary files from your computer,…

15 Best Online Multiplayer Cricket Games for Android [2021]

Cricket is one of the biggest sports in the world and in…