0

I am trying test my application on an emulator but it will not work. However, it works fine on my phone. I have a Samsung Galaxy S2 with version 4.0.3. How do I create an emulator that will work with this?

These are the errors and here it is in pastebin http://pastebin.com/PR65kGxg:

03-05 15:03:16.777: W/Trace(856): Unexpected value from nativeGetEnabledTags: 0
03-05 15:03:16.967: W/Trace(856): Unexpected value from nativeGetEnabledTags: 0
03-05 15:03:16.967: W/Trace(856): Unexpected value from nativeGetEnabledTags: 0
03-05 15:03:17.387: W/GooglePlayServicesUtil(856): Google Play services out of date.  Requires 2012100 but found 1015
03-05 15:03:17.427: W/GooglePlayServicesUtil(856): Google Play services out of date.  Requires 2012100 but found 1015
03-05 15:03:17.467: W/GooglePlayServicesUtil(856): Google Play services out of date.  Requires 2012100 but found 1015
03-05 15:03:17.497: W/GooglePlayServicesUtil(856): Google Play services out of date.  Requires 2012100 but found 1015
03-05 15:03:17.527: W/GooglePlayServicesUtil(856): Google Play services out of date.  Requires 2012100 but found 1015
03-05 15:03:17.887: W/GooglePlayServicesUtil(856): Google Play services out of date.  Requires 2012100 but found 1015
03-05 15:03:17.887: D/AndroidRuntime(856): Shutting down VM
03-05 15:03:17.897: W/dalvikvm(856): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
03-05 15:03:17.917: E/AndroidRuntime(856): FATAL EXCEPTION: main
03-05 15:03:17.917: E/AndroidRuntime(856): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.neatspots/com.example.neatspots.MainActivity}: java.lang.NullPointerException
03-05 15:03:17.917: E/AndroidRuntime(856):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-05 15:03:17.917: E/AndroidRuntime(856):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-05 15:03:17.917: E/AndroidRuntime(856):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-05 15:03:17.917: E/AndroidRuntime(856):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-05 15:03:17.917: E/AndroidRuntime(856):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-05 15:03:17.917: E/AndroidRuntime(856):  at android.os.Looper.loop(Looper.java:137)
03-05 15:03:17.917: E/AndroidRuntime(856):  at android.app.ActivityThread.main(ActivityThread.java:5039)
03-05 15:03:17.917: E/AndroidRuntime(856):  at java.lang.reflect.Method.invokeNative(Native Method)
03-05 15:03:17.917: E/AndroidRuntime(856):  at java.lang.reflect.Method.invoke(Method.java:511)
03-05 15:03:17.917: E/AndroidRuntime(856):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-05 15:03:17.917: E/AndroidRuntime(856):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-05 15:03:17.917: E/AndroidRuntime(856):  at dalvik.system.NativeStart.main(Native Method)
03-05 15:03:17.917: E/AndroidRuntime(856): Caused by: java.lang.NullPointerException
03-05 15:03:17.917: E/AndroidRuntime(856):  at com.example.neatspots.MainActivity.setMapDefaults(MainActivity.java:89)
03-05 15:03:17.917: E/AndroidRuntime(856):  at com.example.neatspots.MainActivity.onCreate(MainActivity.java:73)
03-05 15:03:17.917: E/AndroidRuntime(856):  at android.app.Activity.performCreate(Activity.java:5104)
03-05 15:03:17.917: E/AndroidRuntime(856):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-05 15:03:17.917: E/AndroidRuntime(856):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-05 15:03:17.917: E/AndroidRuntime(856):  ... 11 more
03-05 15:03:18.187: D/dalvikvm(856): GC_CONCURRENT freed 244K, 13% free 2530K/2892K, paused 8ms+71ms, total 260ms
03-05 15:03:37.127: I/Process(856): Sending signal. PID: 856 SIG: 9

This is line 89:

public void setMapDefaults()
{
    map.setMapType(GoogleMap.MAP_TYPE_NORMAL); //line 89
    map.setMyLocationEnabled(true);
}
Kara
  • 6,115
  • 16
  • 50
  • 57
Johnathan Au
  • 5,244
  • 18
  • 70
  • 128
  • What happens when you run it on the emulator? Does it crash? What's in the logcat? – Andrii Chernenko Mar 05 '13 at 14:53
  • What is the question? What is wrong with your emulator or how do set up an emulator? – Mike D Mar 05 '13 at 14:54
  • 1
    What are your APIs in your manifest? – r0- Mar 05 '13 at 14:54
  • What are your minimum and target sdk versions of your application, as well as the api version on your emulator? – Brent Hronik Mar 05 '13 at 14:56
  • This is what I have in the manifest: . I have tried different API versions on my emulator and it gives the error message in the emulator that the application has stopped working – Johnathan Au Mar 05 '13 at 14:59
  • Post the errors from the logcat on your emulator – David Wasser Mar 05 '13 at 15:04
  • could you please post the related code about this line: `MainActivity.setMapDefaults(MainActivity.java:89)`? – dumbfingers Mar 05 '13 at 15:08
  • This sounds like bad news; _Google Play services out of date. Requires 2012100 but found 1015_ especially the words "Requires" – BrantApps Mar 05 '13 at 15:14
  • This doesn't mean I have to start all over again does it? :S I'm half way through developing... – Johnathan Au Mar 05 '13 at 15:16
  • 1
    No- your code is fine. I suspect you should have a read of [this question](http://stackoverflow.com/questions/13691943/this-app-wont-run-unless-you-update-google-play-services-via-bazaar) - it sounds very similar. I am about to start using these new V2 Google Play Services so hopefully with a bit of an SDK update you'll be back on track. – BrantApps Mar 05 '13 at 15:20
  • Thanks, that's exactly the question on SO I was looking for – Johnathan Au Mar 05 '13 at 15:21
  • Good stuff. I added that as an answer in case that 100% answers your question as to why it wasn't working. The guidelines are a bit subjective as to what corresponds to a duplicate but from my first glance your issue *is* different to the linked question albeit they have the same cause and resolution. – BrantApps Mar 05 '13 at 15:32

3 Answers3

1

Create a new virtual device and in target select Google API level 17 and it will work.

manishpro
  • 141
  • 8
0

Your app uses maps API so check if emulator has Google APIs 4.0 target, not a simple Android 4.0

amukhachov
  • 5,822
  • 1
  • 41
  • 60
0

Ok. I had a read of the SO guidelines of duplicates and deemed this question different enough to this question in order to merit an answer which states "this could be the same problem as this question" type answer/comment thing. Any moderators out feel free to tidy this up.

Basically- Jonathan's code is fine despite the NPE. It's likely the emulator-Google V2 Play Service compatibility issue.

Community
  • 1
  • 1
BrantApps
  • 6,362
  • 2
  • 27
  • 60