ionic-team / ionic-native-google-maps

Google maps plugin for Ionic Native
Other
221 stars 125 forks source link

App crashes on android devices #122

Closed Holbanner closed 5 years ago

Holbanner commented 5 years ago

I'm submitting a ... (check one with "x")

If you choose 'problem or bug report', please select OS: (check one with "x")

cordova information: (run $> cordova plugin list)

com.lampa.startapp 6.1.6 "startApp"
cordova-android-support-gradle-release 1.4.5 "cordova-android-support-gradle-release"
cordova-custom-config 5.0.2 "cordova-custom-config"
cordova-open-native-settings 1.5.1 "Native settings"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-add-swift-support 1.7.1 "AddSwiftSupport"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-appavailability 0.4.2 "AppAvailability"
cordova-plugin-brightness 0.1.5 "Brightness"
cordova-plugin-calendar 5.1.2 "Calendar"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-datepicker 0.9.3 "DatePicker"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-opener2 2.0.19 "File Opener2"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.5.0-beta-20181030-1133 "cordova-plugin-googlemaps"
cordova-plugin-http 1.2.0 "SSL Pinning"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-ionic-webview 2.2.0 "cordova-plugin-ionic-webview"
cordova-plugin-nativegeocoder 3.1.2 "NativeGeocoder"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.4.1 "SocialSharing"
cordova-sqlite-storage 2.5.1 "Cordova sqlite storage plugin"
cordova-support-google-services 1.1.0 "cordova-support-google-services"
cordova.plugins.diagnostic 4.0.10 "Diagnostic"
es6-promise-plugin 4.2.2 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-multidex 1.0.0 "Multidex"
phonegap-plugin-push 2.2.3 "PushPlugin"
uk.co.workingedge.phonegap.plugin.launchnavigator 4.1.3 "Launch Navigator"

If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly) "@ionic-native/core": "^4.17.0", "@ionic-native/google-maps": "^4.15.1",

Current behavior:

When opening the map on Android devices, the App crashes without errors. Works fine on IOS

Expected behavior:

The map opens Screen capture or video record:

Related code, data or error log (please format your code or data):

Here is how i create and open the map :

this.mapHTML = document.getElementById('map');
        this.gMap = GoogleMaps.create(this.mapHTML);
        let appRoot = <HTMLCollectionOf<any>>document.getElementsByClassName("app-root");
        this.appRoot = appRoot[1];
        this.appRoot.style.opacity = 0;

        this.gMap.one(GoogleMapsEvent.MAP_READY).then(() => {......}

the crash occures on GoogleMaps.create(this.mapHTML);

Allready tried to change my app name using the in the config.xml, but still get the crash

wf9a5m75 commented 5 years ago

Please share your project files on GitHub.

Holbanner commented 5 years ago

Would if i was allowed to.

wf9a5m75 commented 5 years ago

If you were I, what you would do?

Holbanner commented 5 years ago

Wait for me to drop actual code repo, which i'm trying to do but i don't reproduce the crash on a small project with the same code implementation. Since i've got plenty of plugins amongst which there are android known dependencies problem, i hoped you add any ideas on the part. Maybe even seen the problem elsewhere' I'll just close and keep looking, thanks for your time

Holbanner commented 5 years ago

Hi, Reopenning this since I managed to trime the project enough to be allowed to share it while reproducing the issue. Here is the github repo : https://github.com/Holbanner/ionimaps-issue.git

Please not that for it to work, once you've added android platform you should set all android support libraries version to 27.+, both play-service lib to 16.0.0 and firebase messaging to 17.3.4. I usually do this by changing them in /platforms/android/project.properties

You'll also might need a google-services.json file for firebase plugin to let you compile. If you need me to provide it, please reach out to me so i can provide it to you privately

wf9a5m75 commented 5 years ago

I don't support the conflict problem with other plugins.

Please recreate a project which uses only this plugin. Until the time, I close this thread.

Holbanner commented 5 years ago

Allright, found the source of the problem. Not sure as to why i'm the only one facing this. The app crashes because it doesn't find the API key In the AndroidManifest.xml

Manually adding the key to platforms/android/app/src/main/AndroidManifest.xml makes it work.

For some reasons the first time i compile it, it add the key, then if i recompile it, it removes the key from android.xml Edit : if someone ever digs this up here was the problem :Since cordova-custom-config@5 now needs variable to be prefixed to custom-variable in the config.xml to be written in the androidManifest.xml, hence the API key not being taken into account.