question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashes on creating map

See original GitHub issue

Describe the bug I installed this plugin, updated the specific files as described and built the app. The build was successful but the app crashes at the point of creating the map. I checked the api key and it is okay since it works well when I use it elsewhere. This is the crash log

java.lang.NullPointerException: Attempt to invoke virtual method 'double java.lang.Double.doubleValue()' on a null object 
reference	at com.hemangkumar.capacitorgooglemaps.CapacitorGoogleMaps$1.run(CapacitorGoogleMaps.java:135)	at 
android.os.Handler.handleCallback(Handler.java:790)	at android.os.Handler.dispatchMessage(Handler.java:99)	at 
android.os.Looper.loop(Looper.java:164)	at android.app.ActivityThread.main(ActivityThread.java:6543)	at 
java.lang.reflect.Method.invoke(Native Method)	at 
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)	at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)

To Reproduce Steps to reproduce the behavior:

  1. Install the plugin
  2. Build the app
  3. Run the app
  4. See error

Expected behavior The map should display when the app is run.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
tolutronicscommented, Oct 10, 2021

Somehow, the latitude and longitude parameters that where suppossedly optional in the CapacitorGoogleMaps.create were causing the error when not provided, so you need to provide those fields

const boundingRect = this.yourMapView.nativeElement.getBoundingClientRect() as DOMRect; CapacitorGoogleMaps.create({ width: Math.round(boundingRect.width), height: Math.round(boundingRect.height), x: Math.round(boundingRect.x), y: Math.round(boundingRect.y), zoom: 5, latitude:xxxxxxxxx, // you can get the location and add the latitude longitude:xxxxxxx. // you can get the location and add the longitude });

1reaction
tolutronicscommented, Oct 11, 2021

ok, i will look into it

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix Maps when it crashes - Android - Google Maps Help
On your Android phone or tablet, open the Settings app . · Tap Apps & notifications. · Follow the steps on your device...
Read more >
App crashes on creating map · Issue #114 - GitHub
Steps to reproduce the behavior: Install the plugin; Build the app; Run the app; See error ... The map should display when the...
Read more >
App Crashing with MapKit | Apple Developer Forums
I've been trying to add a MapKit to my app where you can see a location on the map. I'm not trying to...
Read more >
How to fix Map App (Crashes on Windows 10)?
Try re-registering Maps app. Perform these steps: 1. Search for Windows PowerShell using Cortana or Windows Search. 2. From results, right click ...
Read more >
Top 8 Ways to Fix Google Maps Keeps Crashing on Android
1. Force Stop Google Maps · 2. Restart Your Device · 3. Check App Permissions · 4. Clear Cache and Data · 5....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found