I have flutter apps that contain location package and google-maps-flutter package inside my screen.. but whenever I install my app in debug version... my app always close unexpectedly... is there a reason why my app that contain google maps and location package always get sudden close or get lost connection to device and is there a way to prevent that problem?
Asked
Active
Viewed 358 times
2
-
if you are getting an error in the console please share it – HII May 13 '20 at 10:25
-
I didn't get any error in console.. I always get message ```lost connection to device``` in my console and my app is closed.. it is also happen when I install in debug version – wahyu May 13 '20 at 10:28
-
what device are you using ? Android or ios? – Shubham Gupta May 13 '20 at 10:48
-
this is most likely because the application is throwing an exception in the first page itself. for debugging purpose could you try moving it to another page and try to debug when you open the new page. – Anirudh Bagri May 13 '20 at 11:01
-
@subham I am using android and I keep getting sudden close in my apps – wahyu May 13 '20 at 11:35
-
@AnirudhBagri my first page is fine and when I move to second page that contain real time location (I am using location package and google-maps-flutter package)... I get message ```lost connection to device``` after 3-5 seconds waiting for update location user... usually I will get an ```paused on exception``` when there is something wrong.. but here I can not figure out whats the problem that makes sudden closed app – wahyu May 13 '20 at 11:39
-
Do you map license file in place? Also, Make sure you ask for location permission before enabling the map. – Anirudh Bagri May 13 '20 at 11:52
-
@AnirudhBagri I have added permission for location by doing this https://stackoverflow.com/questions/61764390/how-to-handle-gps-location-provider-requires-access-fine-location-permission/61765112#61765112... but would you like to give me idea about what do you mean by map license file in place – wahyu May 13 '20 at 11:58
-
To use Google Maps, you must have API key in place. – Anirudh Bagri May 13 '20 at 12:06
-
@AnirudhBagri I have added my apikey in androidmanifest – wahyu May 13 '20 at 12:10
-
is there something that I should add like build.gradle or something? – wahyu May 13 '20 at 12:11
-
And you have playservices.json file also added? – Anirudh Bagri May 13 '20 at 12:16
-
@AnirudhBagri yes I have added it... is there a relation between apikey inside android manifest file and apikey inside google-service.json? – wahyu May 13 '20 at 12:24
-
because when I take a look... apikey inside my android manifest is different with apikey inside google-service.json – wahyu May 13 '20 at 12:30
-
you need to add both of them. – Anirudh Bagri May 13 '20 at 12:58
-
did you try to launch the application from Android Studio to get the phone's console to know the reason of the crash ? – Yacine Belarbi May 13 '20 at 12:14
-
I open new question in https://stackoverflow.com/questions/61788319/how-to-handling-app-that-get-sudden-close-in-flutter and update the error message.. maybe anyone can help me – wahyu May 14 '20 at 02:36