Coder Social home page Coder Social logo

Mapkit on android about mapkit HOT 15 CLOSED

imhotep avatar imhotep commented on June 9, 2024
Mapkit on android

from mapkit.

Comments (15)

elliotstokes avatar elliotstokes commented on June 9, 2024

also added a try catch around the init in the js and that doesn't fire either.

from mapkit.

majdisorder avatar majdisorder commented on June 9, 2024

I believe I have a similar issue.
I had some trouble getting this thing to build with google play services, but after some minor changes to the code it finally worked (there was an obsolete exception type in there somewhere).
I can't get the thing to run though. After checking in an emulator i figured out the problem is with Google play services. I have already tried different approaches for adding play services: the approach sugested in the Mapkit install, mannually adding it to the libs folder and even using a plugin (https://github.com/MobileChromeApps/google-play-services) which automates the steps required. I also checked this guide : http://developer.android.com/google/play-services/setup.html, but I still can't get it working.
Currently I'm getting these errors from the emulator, and I'm really getting kind of stuck: (there is some more stuff, but I think this is the most relevant)

06-13 04:26:30.715: E/dalvikvm(1115): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.showErrorDialogFragment
06-13 04:26:30.715: W/dalvikvm(1115): VFY: unable to resolve instanceof 146 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
06-13 04:26:30.715: D/dalvikvm(1115): VFY: replacing opcode 0x20 at 0x0008
06-13 04:26:30.725: E/dalvikvm(1115): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.showErrorDialogFragment
06-13 04:26:30.725: W/dalvikvm(1115): VFY: unable to resolve check-cast 146 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
06-13 04:26:30.725: D/dalvikvm(1115): VFY: replacing opcode 0x1f at 0x000c
06-13 04:26:30.745: W/dalvikvm(1115): VFY: unable to resolve static field 147 (common_google_play_services_notification_ticker) in Lcom/google/android/gms/R$string;
06-13 04:26:30.745: D/dalvikvm(1115): VFY: replacing opcode 0x60 at 0x0005
06-13 04:26:30.755: E/GooglePlayServicesUtil(1115): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
06-13 04:26:30.765: W/GooglePlayServicesUtil(1115): Google Play services is missing.
06-13 04:26:30.775: D/AndroidRuntime(1115): Shutting down VM
06-13 04:26:30.775: W/dalvikvm(1115): threadid=1: thread exiting with uncaught exception (group=0xb2a82ba8)
06-13 04:26:30.795: E/AndroidRuntime(1115): FATAL EXCEPTION: main
06-13 04:26:30.795: E/AndroidRuntime(1115): Process: be.dimitritroncquo.maptest, PID: 1115
06-13 04:26:30.795: E/AndroidRuntime(1115): java.lang.NoClassDefFoundError: com.google.android.gms.R$string
06-13 04:26:30.795: E/AndroidRuntime(1115): at com.google.android.gms.common.GooglePlayServicesUtil.c(Unknown Source)
06-13 04:26:30.795: E/AndroidRuntime(1115): at com.google.android.gms.common.GooglePlayServicesUtil.getErrorDialog(Unknown Source)
06-13 04:26:30.795: E/AndroidRuntime(1115): at com.phonegap.plugins.mapkit.MapKit$1.run(MapKit.java:104)
06-13 04:26:30.795: E/AndroidRuntime(1115): at android.os.Handler.handleCallback(Handler.java:733)
06-13 04:26:30.795: E/AndroidRuntime(1115): at android.os.Handler.dispatchMessage(Handler.java:95)
06-13 04:26:30.795: E/AndroidRuntime(1115): at android.os.Looper.loop(Looper.java:136)
06-13 04:26:30.795: E/AndroidRuntime(1115): at android.app.ActivityThread.main(ActivityThread.java:5017)
06-13 04:26:30.795: E/AndroidRuntime(1115): at java.lang.reflect.Method.invokeNative(Native Method)
06-13 04:26:30.795: E/AndroidRuntime(1115): at java.lang.reflect.Method.invoke(Method.java:515)
06-13 04:26:30.795: E/AndroidRuntime(1115): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-13 04:26:30.795: E/AndroidRuntime(1115): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-13 04:26:30.795: E/AndroidRuntime(1115): at dalvik.system.NativeStart.main(Native Method)
06-13 04:31:32.245: I/Process(1115): Sending signal. PID: 1115 SIG: 9

Any help would be greatly appreciated.

from mapkit.

imhotep avatar imhotep commented on June 9, 2024

@dimitritron last I checked Google Play Services don't work on Emulators. One has to use a physical device. I should revive this plugin as it seems like a lot of people are trying to use it.
@elliotstokes does the map show up ?

from mapkit.

elliotstokes avatar elliotstokes commented on June 9, 2024

No. Nothing. Not even an exception. Doesn't call sucess or fail callback.
Works on ios though.
On 13 Jun 2014 19:14, "Anis Kadri" [email protected] wrote:

@dimitritron https://github.com/dimitritron last I checked Google Play
Services don't work on Emulators. One has to use a physical device. I
should revive this plugin as it seems like a lot of people are trying to
use it.
@elliotstokes https://github.com/elliotstokes does the map show up ?


Reply to this email directly or view it on GitHub
#42 (comment).

from mapkit.

imhotep avatar imhotep commented on June 9, 2024

@elliotstokes what does adb logcat tell you ? It sounds like the plugin is not getting loaded. Most likely because there is no reference to it in res/xml/config.xml inside your android project (if you're using CLI it's under platforms/android/res/xml/config.xml).

from mapkit.

elliotstokes avatar elliotstokes commented on June 9, 2024

I'll check it out and get back to you. Thanks for the suggestion.
On 13 Jun 2014 19:23, "Anis Kadri" [email protected] wrote:

@elliotstokes https://github.com/elliotstokes what does adb logcat tell
you ? It sounds like the plugin is not getting loaded. Most likely because
there is no reference to it in res/xml/config.xml inside your android
project (if you're using CLI it's under
platforms/android/res/xml/config.xml).


Reply to this email directly or view it on GitHub
#42 (comment).

from mapkit.

majdisorder avatar majdisorder commented on June 9, 2024

I get an error msg on my my phone as well. I'll try to hook it up to a debugger as soon as possible and see what I get.

from mapkit.

morinted avatar morinted commented on June 9, 2024

Hi @imhotep,

Following the steps in plugin.xml, manually adding the relative path the build.xml, and finally editing the Java code to remove the deprecated exception (line 73), I got the plugin building. When I call it, I get the error call back with no details. I am excluding pins while testing.

Here's some logcat for while I tap my button, which calls showMap(). You can see the LG phone is doing some other stuff, but as far as I can tell the Java doesn't really give any description.

I/ViewRootImpl(31686): ViewRoot's Touch Event : Touch Down
I/ViewRootImpl(31686): ViewRoot's Touch Event : Touch UP
D/CordovaLog(31686): file:///android_asset/www/app/map/map.js: Line 42 : error
I/chromium(31686): [INFO:CONSOLE(42)] "error", source: file:///android_asset/www/app/map/map.js (42)
D/BubblePopupHelper( 1131): isShowingBubblePopup : false
I/ViewRootImpl(31686): ViewRoot's Touch Event : Touch Down
I/ViewRootImpl(31686): ViewRoot's Touch Event : Touch UP
I/Vold    (  280): [LGE][VOLD][NetlinkHandler.cpp][onEvent()] subsys:cpu, action:0
I/Vold    (  280): [LGE][VOLD][NetlinkHandler.cpp][onEvent()] subsys:cpu, action:0
D/CordovaLog(31686): file:///android_asset/www/app/map/map.js: Line 42 : error
I/chromium(31686): [INFO:CONSOLE(42)] "error", source: file:///android_asset/www/app/map/map.js (42)

from mapkit.

elliotstokes avatar elliotstokes commented on June 9, 2024

@imhotep Ok. After fiddling about I managed to get the error MapKit is not defined. THis fires on the try catch around the call. I checked my config.xml file and have

<feature name="MapKit">
    <param name="android-package" value="com.phonegap.plugins.mapkit.MapKit" />
</feature>

in there. Im using cordova if that makes a difference. Like I said all is fine in ios. Any recommendations? The error itself seems pretty self explanatory just being a n00b.

from mapkit.

majdisorder avatar majdisorder commented on June 9, 2024

Okay. I finally got around to testing on a physical device, and it appears I had just forgotten to add some permissions to the manifest. Silly me.

These are the steps I went trough to get the bloody thing working:

  1. Set up a new cordova project (or use an existing one)
  2. install the mapkit plugin with your google api key
  3. Get the google play services jar using the android sdk manager
  4. Copy the jar to the myproject\platforms\android\libs folder
  5. change the myproject\platforms\android\AndroidManifest.xml to include:
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    This goes in the <application> section. Alternatively, you could dowload and install this project: https://github.com/MobileChromeApps/google-play-services
    Which bassically automates steps 3-5 as a cordova plugin
  6. Fix the Mapkit.java file (there is a GooglePlayServicesNotAvailableException in there somewhere which is obsolete, just remove the try/catch)
  7. change the myproject\platforms\android\AndroidManifest.xml to include the following permissions:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

from mapkit.

spath avatar spath commented on June 9, 2024

This thread has been very helpful! @dimitritron the lack of those permissions was causing the app to exit abruptly with no error messages. Thank you! I've been at this for about 2 weeks making slow progress but I'm feeling very stuck at the moment.

Running cordova 3.5.0-0.2.4
Android sdk toolds 23.0.2
sdk platform 19

I'm wondering if anyone knows what might cause the map to be blank? I checked my google developer console and it appears that google has received no API requests and there are no errors on my Google project. mapKit.addMapPins and mapKit.showMap are successful but my map is empty.
ON the console I see

 "Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors)."

I see many people talking about re-creating their certificates. I created my certificate with these options (and I've also tried with keysize 1024) Do these options look OK?

keytool -genkeypair -v -keystore appname.keystore -alias appname -keyalg RSA -keysize 2048 -validity 10000

I'm also not sure the libraries are loaded correctly. I tried doing as the documentation specified and ran this (although I don't understand what is going on behind the scenes here...)

android update project -p . -t android-19 -l ..\PATHTOSDK\sdk\extras\google\google_play_services\libproject\google-play-services_li
b\

and I've also tried copying android-support-v4.jar and google-play-services into the /platforms/android/libs directory, as specified above.

During the build I see these jars in the path for some reason the support is in the cordova project directory but the GPS is still over in the google sdk directory... Not sure why that is or if it might cause a problem

-pre-compile:
     [echo] Set jars path to: 
C:\DEV\AndroidDev\testapp\platforms\android\CordovaLib\ant-build\classes.jar;
C:\DEV\AndroidDev\adt-bundle-windows-x86_64-20140321\adt-bundle-windows-x86_64-20140321\sdk\extras\google\google_play_services\libproject\google-play-services_lib\ant-build\classes.jar;
C:\DEV\AndroidDev\testapp\platforms\android\libs\android-support-v4.jar;
C:\DEV\AndroidDev\adt-bundle-windows-x86_64-20140321\adt-bundle-windows-x86_64-20140321\sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs\google-play-services.jar

Here are the warnings and errors I see from Android Device Monitor
warn

Here is a screen shot of what my blank map looks like.
image

from mapkit.

spath avatar spath commented on June 9, 2024

Update: I don't think it is a library problem because resultCode is good. and I see some other threads indicating that "google play resources services not found" error can be ignored.

 final int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(cordova.getActivity());

from mapkit.

majdisorder avatar majdisorder commented on June 9, 2024

I ran into a similar problem and quite frankly, after all the time spent, I was getting quite fed up and ended up using a different library. You can find it here:
https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Map
It's feature rich and under active development, so it might be interesting to take a look at.

from mapkit.

spath avatar spath commented on June 9, 2024

Thanks Dimitritron. I've gone through line by line in MapKit.java and I just don't see where the problem is. I've confirmed MapsInitializer.initialize is returning success and none of my objects are null... I'm starting to wonder if maybe it isn't something to do with the recent modifications to webview as detailed here https://developer.android.com/guide/webapps/migrating.html. @imhotep? Any thoughts? Have you ever seen this application run on a 4.4 device?

from mapkit.

imhotep avatar imhotep commented on June 9, 2024

Yes, indeed. Try the latest and let me know.

from mapkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.