{"id":6218,"date":"2014-04-13T23:30:19","date_gmt":"2014-04-13T23:30:19","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/google-maps-android-v2-application-crashing-collection-of-common-programming-errors\/"},"modified":"2014-04-13T23:30:19","modified_gmt":"2014-04-13T23:30:19","slug":"google-maps-android-v2-application-crashing-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/google-maps-android-v2-application-crashing-collection-of-common-programming-errors\/","title":{"rendered":"Google Maps Android V2 application crashing-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/63b86965912b5cc046118cea78d87e43?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nStudent<\/p>\n<p>I am working on a project that includes location detection using the GPS so I found this code that included a working .apk file but when I tried to compile it and run it, it always crashes. The application crashes when I try opening it in an emulator or on a Samsung S4 mobile. N.B. I&#8217;ve chosen the correct target which is API 17 and downloaded Google play services and included it in the library of the project.<\/p>\n<p>Here is the code if anyone can help<\/p>\n<p><strong>Manifest file<\/strong><\/p>\n<pre><code>  \n   \n\n    \n\n\n\n\n\n\n\n\n\n\n      \n    \n        \n            \n\n            \n        \n    \n\n\n \n<\/code><\/pre>\n<p><strong>MainActivity.java<\/strong><\/p>\n<pre><code>package info.tekguc.umut.googlemapsmapsandroidv2;\n\nimport android.os.Bundle; \nimport android.app.Activity;\nimport android.view.Menu;\nimport com.google.android.gms.maps.GoogleMap;\nimport com.google.android.gms.maps.MapFragment;\nimport com.google.android.gms.maps.model.LatLng;\nimport com.google.android.gms.maps.model.Marker;\nimport com.google.android.gms.maps.model.MarkerOptions;\n\npublic class MainActivity extends Activity {\nprivate GoogleMap mMap;\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n    setContentView(R.layout.activity_main);\n\n\n    mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))\n            .getMap();\n    mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);\n    final LatLng CIU = new LatLng(35.21843892856462, 33.41662287712097);\n    Marker ciu = mMap.addMarker(new MarkerOptions().position(CIU).title(\n            \"My Office\"));\n\n}\n\n@Override\npublic boolean onCreateOptionsMenu(Menu menu) {\n    \/\/ Inflate the menu; this adds items to the action bar if it is present.\n    getMenuInflater().inflate(R.menu.main, menu);\n    return true;\n}\n }\n<\/code><\/pre>\n<p><strong>activity_main.xml<\/strong><\/p>\n<pre><code>   \n\n    \n\n    \n\n\n<\/code><\/pre>\n<p><strong>Logcat<\/strong><\/p>\n<pre><code>12-25 17:30:32.450: D\/dalvikvm(286): GC_FOR_ALLOC freed 6K, 15% free 7250K\/8524K, paused 487ms, total 487ms\n12-25 17:30:32.940: D\/dalvikvm(286): GC_FOR_ALLOC freed 253K, 18% free 6999K\/8524K, paused 463ms, total 465ms\n12-25 17:30:32.950: W\/BroadcastQueue(286): Failure sending broadcast Intent { act=android.intent.action.SIM_STATE_CHANGED flg=0x20000010 (has extras) }\n12-25 17:30:32.950: W\/BroadcastQueue(286): android.os.DeadObjectException\n12-25 17:30:32.950: W\/BroadcastQueue(286):  at android.os.BinderProxy.transact(Native Method)\n12-25 17:30:32.950: W\/BroadcastQueue(286):  at android.content.IIntentReceiver$Stub$Proxy.performReceive(IIntentReceiver.java:124)\n12-25 17:30:32.950: W\/BroadcastQueue(286):  at com.android.server.am.BroadcastQueue.performReceiveLocked(BroadcastQueue.java:376)\n12-25 17:30:32.950: W\/BroadcastQueue(286):  at com.android.server.am.BroadcastQueue.deliverToRegisteredReceiverLocked(BroadcastQueue.java:439)\n12-25 17:30:32.950: W\/BroadcastQueue(286):  at com.android.server.am.BroadcastQueue.processNextBroadcast(BroadcastQueue.java:487)\n12-25 17:30:32.950: W\/BroadcastQueue(286):  at com.android.server.am.BroadcastQueue$1.handleMessage(BroadcastQueue.java:140)\n12-25 17:30:32.950: W\/BroadcastQueue(286):  at android.os.Handler.dispatchMessage(Handler.java:99)\n12-25 17:30:32.950: W\/BroadcastQueue(286):  at android.os.Looper.loop(Looper.java:137)\n12-25 17:30:32.950: W\/BroadcastQueue(286):  at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1480)\n12-25 17:30:34.300: I\/ActivityManager(286): Start proc com.google.process.gapps for content provider com.google.android.gsf\/.settings.GoogleSettingsProvider: pid=518 uid=10019 gids={50019, 3003, 1007, 1028, 1015, 1006, 2001, 3006}\n12-25 17:30:34.350: W\/ActivityManager(286): Activity idle timeout for ActivityRecord{40f692c8 u0 com.android.launcher\/com.android.launcher2.Launcher}\n12-25 17:30:34.380: D\/dalvikvm(37): GC_EXPLICIT freed 35K, 6% free 2403K\/2552K, paused 4ms+7ms, total 96ms\n12-25 17:30:34.410: W\/ActivityManager(286): Timeout executing service: ServiceRecord{40fa9d20 u0 com.android.inputmethod.latin\/.LatinIME}\n12-25 17:30:34.480: D\/dalvikvm(37): GC_EXPLICIT freed<\/code><\/pre>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Student I am working on a project that includes location detection using the GPS so I found this code that included a working .apk file but when I tried to compile it and run it, it always crashes. The application crashes when I try opening it in an emulator or on a Samsung S4 mobile. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6218","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6218"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6218\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}