react-native-maps: Build Error on React Native 0.59.0 version
Is this a bug report?
YES - The is a Bug
Have you read the Installation Instructions?
YES
Environment
react-native: 0.59.0 react: 16.8.3 react-native-maps: 0.23.0 Target: Android 28
Steps to Reproduce
- Create Sample Project using React Native 0.59.0
- Install React Native Maps
- Run
react-native run-android
Expected Behavior
Build Successfully
Actual Behavior
Build Failed
Error Message:
Could not resolve com.android.support:support-compat:28.0.0.
Required by:
project :react-native-maps > com.facebook.react:react-native:0.59.0 > com.android.support:appcompat-v7:28.0.0
project :react-native-maps > com.android.support:support-core-utils:28.0.0
project :react-native-maps > com.android.support:support-fragment:28.0.0
project :react-native-maps > com.facebook.react:react-native:0.59.0 > com.android.support:appcompat-v7:28.0.0 > com.android.support:support-vector-drawable:28.0.0
project :react-native-maps > com.android.support:support-core-utils:28.0.0 > com.android.support:loader:28.0.0
project :react-native-maps > com.android.support:support-core-ui:28.0.0
project :react-native-maps > com.android.support:support-core-ui:28.0.0 > com.android.support:customview:28.0.0
project :react-native-maps > com.android.support:support-core-ui:28.0.0 > com.android.support:viewpager:28.0.0
project :react-native-maps > com.android.support:support-core-ui:28.0.0 > com.android.support:coordinatorlayout:28.0.0
........
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 21
- Comments: 43 (2 by maintainers)
@kdenz You are right. Next release will fix it!
If you guys prefer to locking to a specific commit you can use the current one:
downgrade react-native version to 0.55.4 then build will success
I’ve fixed it by simply installing the master branch, as it includes this fix I believe https://github.com/react-native-community/react-native-maps/pull/2702
npm install git://github.com/react-native-community/react-native-maps.git#master --saveCan someone give us an ETA on the next release? Days, weeks, months?
here is aworkaround
yarn add "react-native-maps@jerolimov/react-native-maps#fix-rn59rc-compile-issues"Thanks @YazeedAsaad
Changing Google play services version from compile “com.google.android.gms:play-services-base:16.0.1” to compile “com.google.android.gms:play-services-maps:16.0.0” also solved my problem.
Also adding at AndroidManifest.xml
<uses-library android:name="org.apache.http.legacy" android:required="false"/>solved the google map app crashing issue.Android root build.gradle was also updated with Google play services version googlePlayServicesVersion = “16.0.0” -
ext { buildToolsVersion = “28.0.3” minSdkVersion = 16 compileSdkVersion = 28 targetSdkVersion = 28 supportLibVersion = “28.0.0”
googlePlayServicesVersion = “16.0.0” androidMapsUtilsVersion = “0.5+” }
@mo-ah-dawood thanks i tried that, the build is successful.
But app crashes when opened view with maps element.
Also tried these changes manually #2702 but still crashes
Adding
<uses-library android:name="org.apache.http.legacy" android:required="false"/>as mentioned by @nazmulhq solved all of my issues!@salah-ghanim any ETA on publishing to npm?
Anything we can do to help?
@sinodko that’s because your device doesn’t have Google Play Services installed. If you use the android emulator check in the SDK Manager that you downloaded the Google Play Services and then in AVD Manager create a new device using Google Play and not Google APIs (nexus 5 has that option and you’ll see the Play Store logo next to the name on the first step).
Ok I found a solution to the problem of the app crashing on map load:
https://stackoverflow.com/questions/50782806/android-google-maps-java-lang-noclassdeffounderror-failed-resolution-of-lorg-a
Same as @rangav, adding master did the trick for Android compile but the app keeps crashing on Android when the MapView is ready. onMapReady gets fired but then the app crashes. I have no error message to understand where it comes from.
On iOS it works fine, no such crashes.
Any idea on to what could cause that?
Seems still issues not resolved for android ,
Tried all the solution from previous comments but no luck showing the map.
is anyone have fixed and sample source code available in github ? I’ve used react-native"0.59.0-rc.3"
PS: My google api keys works fine on react projects, ( did enable Google android maps api )
@MrDatastorage Did you solve you issue?
With master installed, I keep getting blank map with message:
AwesomeProject is having trouble with Google Play services. Please try Again.Edit
everything works fine on iOS
After switch to master branch, I can build success on android, but this version cause leak memory in MapView, so I decide to switch back to version 0.23.0 and change build.gradle file of react-native-maps project to :
-> android build success and no memory leak.
PS: in project build.gradle
that version of RN will have problems with iOS - Archive as it does not support Xcode 10.
Workaround: Open
node_modules/react-native-maps/lib/android/build.gradleand copy & place gradle code from #2702.just to let you all know that “app is having trouble with google play services. please try again” was solved by changing com.google.android.gms:play-services-maps from 16.1.0 to 16.0.0 as :
compile “com.google.android.gms:play-services-base:16.0.1” compile “com.google.android.gms:play-services-maps:16.0.0”