9

I m a newbie to Android. I am trying to use google location API and when run in the emulator it shows Unfortunately your app stopped working. I did a adb logcat and here is my stacktrace

10-31 23:43:02.010  2370  2370 D AndroidRuntime: >>>>>> START     com.android.internal.os.RuntimeInit uid 0 <<<<<<
10-31 23:43:02.011  2370  2370 D AndroidRuntime: CheckJNI is ON
10-31 23:43:02.026  2370  2370 I art     : JIT created with code_cache_capacity=2MB compile_threshold=1000
10-31 23:43:02.030  2370  2370 D ICU     : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
10-31 23:43:02.044  2370  2370 E memtrack: Couldn't load memtrack module (No such file or directory)
10-31 23:43:02.044  2370  2370 E android.os.Debug: failed to load memtrack module: -2
10-31 23:43:02.045  2370  2370 I Radio-JNI: register_android_hardware_Radio DONE
10-31 23:43:02.062  2370  2370 D AndroidRuntime: Calling main entry com.android.commands.pm.Pm
10-31 23:43:02.073  2228  2240 I art     : CollectorTransition marksweep + semispace GC freed 125(-7KB) AllocSpace objects, 0(0B) LOS objects, 57% free, 379KB/891KB, paused 5.591ms total 5.591ms
10-31 23:43:02.080  2228  2242 D DefContainer: Copying /data/local/tmp/HighwayMechanic.apk to base.apk
10-31 23:43:02.181  1138  1177 I PackageManager.DexOptimizer: Running dexopt (dex2oat) on: /data/app/vmdl931695514.tmp/base.apk pkg=com.highway.highwaymechanic isa=x86 vmSafeMode=false debuggable=true oatDir = /data/app/vmdl931695514.tmp/oat
10-31 23:43:02.190  2382  2382 W dex2oat : Unexpected CPU variant for X86 using defaults: x86
10-31 23:43:02.190  2382  2382 W dex2oat : Mismatch between dex2oat instruction set features (ISA: X86 Feature string: smp,-ssse3,-sse4.1,-sse4.2,-avx,-avx2) and those of dex2oat executable (ISA: X86 Feature string: smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2) for the command line:
10-31 23:43:02.190  2382  2382 W dex2oat : /system/bin/dex2oat --zip-fd=6 --zip-location=base.apk --oat-fd=7 --oat-location=/data/app/vmdl931695514.tmp/oat/x86/base.odex --instruction-set=x86 --instruction-set-variant=x86 --instruction-set-features=default --runtime-arg -Xms64m --runtime-arg -Xmx512m --swap-fd=8 --debuggable
10-31 23:43:02.190  2382  2382 I dex2oat : /system/bin/dex2oat --debuggable
10-31 23:43:08.200  2382  2382 I dex2oat : dex2oat took 6.009s (threads: 1) arena alloc=2MB java alloc=6MB native alloc=32MB free=2MB
10-31 23:43:08.276  1138  1162 I ActivityManager: Force stopping com.highway.highwaymechanic appid=10053 user=-1: uninstall pkg
10-31 23:43:08.294  1138  1177 I PackageManager: Package com.highway.highwaymechanic codePath changed from /data/app/com.highway.highwaymechanic-2 to /data/app/com.highway.highwaymechanic-1; Retaining data and using new
10-31 23:43:08.295  1138  1162 I ActivityManager: Force stopping com.highway.highwaymechanic appid=10053 user=-1: replace pkg
10-31 23:43:08.296  1138  1177 W PackageManager: Code path for com.highway.highwaymechanic changing from /data/app/com.highway.highwaymechanic-2 to /data/app/com.highway.highwaymechanic-1
10-31 23:43:08.296  1138  1177 W PackageManager: Resource path for com.highway.highwaymechanic changing from /data/app/com.highway.highwaymechanic-2 to /data/app/com.highway.highwaymechanic-1
10-31 23:43:08.333  1138  1177 W Settings: Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value.
10-31 23:43:08.333  1138  1177 I art     : Starting a blocking GC Explicit
10-31 23:43:08.353  1138  1177 I art     : Explicit concurrent mark sweep GC freed 10787(756KB) AllocSpace objects, 11(220KB) LOS objects, 19% free, 5MB/6MB, paused 517us total 13.651ms
10-31 23:43:08.357  1138  1177 W PackageManager: Couldn't remove dex file for package:  at location /data/app/com.highway.highwaymechanic-2/base.apk, retcode=-1
10-31 23:43:08.359  1138  1177 I ActivityManager: Force stopping com.highway.highwaymechanic appid=10053 user=0: pkg removed
10-31 23:43:08.360  2370  2370 I art     : System.exit called, status: 0
10-31 23:43:08.360  2370  2370 I AndroidRuntime: VM exiting with result code 0.
10-31 23:43:08.400  1138  1138 D JobSchedulerService: Receieved: android.intent.action.PACKAGE_REMOVED
10-31 23:43:08.403  1566  1566 D CarrierServiceBindHelper: Receive action: android.intent.action.PACKAGE_REMOVED
10-31 23:43:08.404  1566  1566 D CarrierServiceBindHelper: mHandler: 3
10-31 23:43:08.404  1138  1255 I InputReader: Reconfiguring input devices.  changes=0x00000010
10-31 23:43:08.414  1925  1925 W ContextImpl: Calling a method in the system process without a qualified user:  android.app.ContextImpl.startService:1221  android.content.ContextWrapper.startService:581 android.content.ContextWrapper.startService:581 com.android.keychain.KeyChainBroadcastReceiver.onReceive:12 android.app.ActivityThread.handleReceiver:2725 
10-31 23:43:08.418  1138  1641 I BroadcastQueue: Delay finish: com.android.keychain/.KeyChainBroadcastReceiver
10-31 23:43:08.514  1138  1255 I InputReader: Reconfiguring input devices.  changes=0x00000010
10-31 23:43:08.515  1138  2212 I BroadcastQueue: Resuming delayed broadcast
10-31 23:43:08.516  1566  1566 D CarrierServiceBindHelper: Receive action: android.intent.action.PACKAGE_ADDED
10-31 23:43:08.516  1566  1566 D CarrierServiceBindHelper: mHandler: 3
10-31 23:43:08.602  1138  1255 I InputReader: Reconfiguring input devices.  changes=0x00000010
10-31 23:43:08.602  1566  1566 D CarrierServiceBindHelper: Receive action: android.intent.action.PACKAGE_REPLACED
10-31 23:43:08.602  1566  1566 D CarrierServiceBindHelper: mHandler: 3
10-31 23:43:08.602  1566  1566 D CarrierConfigLoader: mHandler: 9 phoneId: 0
10-31 23:43:08.617  2390  2390 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
10-31 23:43:08.619  2390  2390 D AndroidRuntime: CheckJNI is ON
10-31 23:43:08.635  2390  2390 I art     : JIT created with code_cache_capacity=2MB compile_threshold=1000
10-31 23:43:08.640  2390  2390 D ICU     : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
10-31 23:43:08.654  2390  2390 E memtrack: Couldn't load memtrack module (No such file or directory)
10-31 23:43:08.654  2390  2390 E android.os.Debug: failed to load memtrack module: -2
10-31 23:43:08.655  2390  2390 I Radio-JNI: register_android_hardware_Radio DONE
10-31 23:43:08.667  2390  2390 D AndroidRuntime: Calling main entry com.android.commands.am.Am
10-31 23:43:08.669  1138  2212 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.highway.highwaymechanic/.MainActivity} from uid 0 on display 0
10-31 23:43:08.691  2390  2390 D AndroidRuntime: Shutting down VM
10-31 23:43:08.695  2390  2395 I art     : Debugger is no longer active
10-31 23:43:08.695  2390  2401 E art     : Thread attaching while runtime is shutting down: Binder_2
10-31 23:43:08.695  2390  2401 I AndroidRuntime: NOTE: attach of thread 'Binder_2' failed
10-31 23:43:08.697  2402  2402 I art     : Not late-enabling -Xcheck:jni (already on)
10-31 23:43:08.697  2402  2402 I art     : Late-enabling JIT
10-31 23:43:08.702  2402  2402 I art     : JIT created with code_cache_capacity=2MB compile_threshold=1000
10-31 23:43:08.708  1138  1712 I ActivityManager: Start proc 2402:com.highway.highwaymechanic/u0a53 for activity com.highway.highwaymechanic/.MainActivity
10-31 23:43:08.717  2402  2409 E art     : Failed sending reply to debugger: Broken pipe
10-31 23:43:08.717  2402  2409 I art     : Debugger is no longer active
10-31 23:43:08.728  2402  2402 W System  : ClassLoader referenced unknown path: /data/app/com.highway.highwaymechanic-1/lib/x86
10-31 23:43:08.747  2402  2402 W GooglePlayServicesUtil: Google Play services is missing.
10-31 23:43:08.747  2402  2402 W GooglePlayServicesUtil: Google Play services is missing.
10-31 23:43:08.747  2402  2402 W GooglePlayServicesUtil: Google Play services is missing.
10-31 23:43:08.747  2402  2402 W GooglePlayServicesUtil: Google Play services is missing.
10-31 23:43:08.748  2402  2402 W GooglePlayServicesUtil: Google Play services is missing. 
10-31 23:43:08.748  2402  2402 W GooglePlayServicesUtil: Google Play services is missing.
10-31 23:43:08.755  2402  2402 W GooglePlayServicesUtil: Google Play services is missing.
10-31 23:43:08.755  2402  2402 W GooglePlayServicesUtil: Google Play services is missing.
10-31 23:43:08.755  2402  2402 W GooglePlayServicesUtil: Google Play services is missing.
10-31 23:43:08.764  2402  2402 W GooglePlayServicesUtil: Google Play services is missing.
10-31 23:43:08.764  2402  2402 W GooglePlayServicesUtil: Google Play services is missing.
10-31 23:43:08.797  2402  2402 D gralloc_goldfish: Emulator without GPU emulation detected.
10-31 23:43:08.818  1138  1170 I ActivityManager: Displayed com.highway.highwaymechanic/.MainActivity: +129ms
10-31 23:43:10.932  1138  1429 I ActivityManager: START u0 {act=android.intent.action.VIEW dat=market://details?id=com.google.android.gms&pcampaignid=gcore_8115000--- flg=0x80000 pkg=com.android.vending} from uid 10053 on display 0
10-31 23:43:10.933  2402  2402 D AndroidRuntime: Shutting down VM
10-31 23:43:10.933  2402  2402 E AndroidRuntime: FATAL EXCEPTION: main
10-31 23:43:10.933  2402  2402 E AndroidRuntime: Process: com.highway.highwaymechanic, PID: 2402
10-31 23:43:10.933  2402  2402 E AndroidRuntime: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.gms&pcampaignid=gcore_8115000--- flg=0x80000 pkg=com.android.vending }
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1798)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.app.Activity.startActivityForResult(Activity.java:3917)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.app.Activity.startActivityForResult(Activity.java:3877)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:748)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.app.Activity.startActivity(Activity.java:4200)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.app.Activity.startActivity(Activity.java:4168)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at com.google.android.gms.dynamic.zza$5.onClick(Unknown Source)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.view.View.performClick(View.java:5198)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.view.View$PerformClick.run(View.java:21147)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:739)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:95)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:148)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:5417)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
10-31 23:43:10.933  2402  2402 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
10-31 23:43:10.934  1138  1712 W ActivityManager:   Force finishing activity com.highway.highwaymechanic/.MainActivity
10-31 23:43:10.935   943   943 D gralloc : Registering a buffer in the process that created it. This may cause memory ordering problems.
10-31 23:43:10.935   943   943 E libEGL  : called unimplemented OpenGL ES API
10-31 23:43:10.935   943   943 E SurfaceFlinger: glCheckFramebufferStatusOES error 1711643839
10-31 23:43:10.935   943   943 E SurfaceFlinger: got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot
10-31 23:43:11.448  1138  1162 W ActivityManager: Activity pause timeout for ActivityRecord{40e8f1c u0 com.highway.highwaymechanic/.MainActivity t11 f}
10-31 23:43:21.478  1138  1162 W ActivityManager: Activity destroy timeout for ActivityRecord{40e8f1c u0 com.highway.highwaymechanic/.MainActivity t11 f}

Here is my Android_manifest.xml

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

    <uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="23" />

    <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
     <meta-data 
         android:name="com.google.android.gms.version" 
         android:value="@integer/google_play_services_version" />
     <activity
        android:name=".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>
      <activity
        android:name="com.highway.highwaymechanic.Map"
        android:label="@string/title_activity_map" >
     </activity>
   </application>
</manifest>

Here is my MainActivity.java file

package com.highway.highwaymechanic;


import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends FragmentActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
  }
}

Here is my MapsActivity.java file

    package com.highway.highwaymechanic;

     import android.os.Bundle;
     import android.support.v4.app.FragmentActivity;
     import com.google.android.gms.maps.CameraUpdateFactory;
     import com.google.android.gms.maps.GoogleMap;
     import com.google.android.gms.maps.OnMapReadyCallback;
     import com.google.android.gms.maps.SupportMapFragment;
     import com.google.android.gms.maps.model.LatLng;
     import com.google.android.gms.maps.model.MarkerOptions;


     public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
    @Override
     protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map);
        SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
        mapFragment.getMapAsync(this);
    }

    @Override
    public void onMapReady(GoogleMap map) {

        LatLng sydney = new LatLng(-34, 151);
        map.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
        map.moveCamera(CameraUpdateFactory.newLatLng(sydney));
     }
   }

When run in the emulator it crashes with Unfortunately the app stopped working.

Please help me with it. Thanks in Advance

Kinjal
  • 1,195
  • 4
  • 13
  • 24
Sahal Sajjad
  • 235
  • 1
  • 5
  • 18
  • 4
    You need to install google play services packages on your emulator, take a look here : http://stackoverflow.com/questions/14040185/running-google-maps-v2-on-the-android-emulator – Bubu Oct 31 '15 at 19:05

3 Answers3

3

I believe this should have been fixed with the latest release of the Google Play services client library. Note that this is a fix in the client library and so you will have to update the library to the latest revision using your SDK manager and recompile your application.

for more details you can check this link

https://code.google.com/p/gmaps-api-issues/issues/detail?id=4862

mahesh singh
  • 202
  • 1
  • 12
0

Do you have an another Activity named Map? As I see in your manifest,

<activity
    android:name="com.highway.highwaymechanic.Map"
    android:label="@string/title_activity_map" >
 </activity>

Likewise, there should be a similar tag for the MapsActivity in your manifest. I think this is the error.

Nizam
  • 5,698
  • 9
  • 45
  • 57
0

it bugs out much sooner, missing some native assembly for x86 architecture:

W System: ClassLoader referenced unknown path: /data/app/com.highway.highwaymechanic-1/lib/x86

followed by:

W GooglePlayServicesUtil: Google Play services is missing.

To add the missing Google Play (incl. Maps) Services, wrote a how-to once (it's almost the same).

While that FragmentActivity requires an IntentFilter, else it cannot be launched, for example:

  <activity
    android:name=".MapsActivity"
    android:label="@string/title_activity_map">
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
    </intent-filter>
 </activity>
Martin Zeitler
  • 1
  • 19
  • 155
  • 216