0

I've been trying to get apps like this to work and as I run them everything will work except google maps. I've copied my API key into them but still to no avail. Is there anything else I'm missing out on?

Error I get when try to run them:

<terminated>CustomMarker [Android Application]  
    <disconnected>DalvikVM[localhost:8607]  

<disconnected>DalvikVM[localhost:8607]  

Any help is appreciated.
PS I am running them on an android phone, not emulator and I suspect it could be a problem with the phone?
edit: more details

[2014-05-12 16:31:57 - CustomMarker] ------------------------------
[2014-05-12 16:31:57 - CustomMarker] Android Launch!
[2014-05-12 16:31:57 - CustomMarker] adb is running normally.
[2014-05-12 16:31:57 - CustomMarker] Performing com.nasc.sample.custommarker.CustomMapMarker activity launch
[2014-05-12 16:31:57 - CustomMarker] Failed to find an AVD compatible with target 'Android 4.2.2'.
[2014-05-12 16:31:58 - CustomMarker] Performing com.nasc.sample.custommarker.CustomMapMarker activity launch
[2014-05-12 16:33:12 - CustomMarker] Uploading CustomMarker.apk onto device '4df190e00d8b5f4d'
[2014-05-12 16:33:12 - CustomMarker] Installing CustomMarker.apk...
[2014-05-12 16:33:21 - CustomMarker] Success!
[2014-05-12 16:33:21 - CustomMarker] Starting activity com.nasc.sample.custommarker.CustomMapMarker on device 4df190e00d8b5f4d
[2014-05-12 16:33:22 - CustomMarker] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.nasc.sample.custommarker/.CustomMapMarker }
[2014-05-12 16:33:23 - CustomMarker] Attempting to connect debugger to 'com.nasc.sample.custommarker' on port 8607

more details:

Description Resource    Path    Location    Type
Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details.    AndroidManifest.xml /CustomMarker   line 7  Android Lint Problem
The method removeGlobalOnLayoutListener(ViewTreeObserver.OnGlobalLayoutListener) from the type ViewTreeObserver is deprecated   CustomMapMarker.java    /CustomMarker/src/com/nasc/sample/custommarker  line 76 Java Problem
The value of the field CustomMapMarker.customMarker is not used CustomMapMarker.java    /CustomMarker/src/com/nasc/sample/custommarker  line 29 Java Problem
jasonrudolph
  • 573
  • 3
  • 8
user2849976
  • 158
  • 1
  • 2
  • 10

2 Answers2

0

What you posted is, at best, something from the console, and is not going to help you. Use LogCat to examine the Java stack trace.

If nothing else, that sample is old enough that it is missing a second <meta-data> element for the Play Services version:

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>

I have a directory full of samples that are up to date that you might try instead, such as the basic sample.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

Even if you copied your API key into the project, you need to add the package name of the app and SHA1 key from the keystore you're using to the Google API Console. This takes about 15 minutes to go live.

Note you can have multiple packages associated with a SHA1 key, and you can associate a package to multiple SHA1 keys. You just have to separate each line in the API console

To do this in the Google Developer Console, Go to the project you're working on -> APIs & auth -> ensure that Google Maps Android API V2 is ON, and click it -> Credentials -> Under Public API Access, find Key for Android applications -> Edit allowed Android Applications

In this window, you add one SHA1 key and one package name per line, with the SHA1 and package separated by a semi colon:

FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:F0;com.example.yourproject
FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:F1;com.example.anotherproject
stewjacks
  • 471
  • 6
  • 12