Reputation: 1177
I am getting following error
Could not get unknown property 'supportLibVersion' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHand
I am working on react-native application and react-native-maps dependencies are below in which I am getting error
dependencies {
def supportLibMajorVersion = supportLibVersion.split('\\.')[0] as int
def appCompatLibName = (supportLibMajorVersion < 20) ? "androidx.appcompat:appcompat" : "com.android.support:appcompat-v7"
implementation "$appCompatLibName:$supportLibVersion"
implementation('com.facebook.react:react-native:+') {
exclude group: 'com.android.support'
}
implementation "com.google.android.gms:play-services-base:${safeExtGet('playServicesVersion', '16.1.0')}"
implementation "com.google.android.gms:play-services-maps:${safeExtGet('playServicesVersion', '16.1.0')}"
implementation 'com.google.maps.android:android-maps-utils:0.5'
}
Anyone have idea what is wrong here?
The error in terminal is
FAILURE: Build failed with an exception.
Where:
Build file 'D:\react native\abhishek\Gwala\node_modules\react-native-maps\lib\android\build.gradle' line: 20What went wrong:
A problem occurred evaluating project ':react-native-maps'.
Could not get unknown property 'supportLibVersion' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
line 20 is
def supportLibMajorVersion = supportLibVersion.split('\\.')[0] as int
Upvotes: 21
Views: 20056
Reputation: 76
Try installing it directly from github:
npm install --save git+https://[email protected]/react-native-community/react-native-maps.git
Upvotes: 3
Reputation: 149
Add below line in node_modules/react-native-maps/lib/android/build.gradle
:
under dependencies
def supportLibVersion = safeExtGet('supportLibVersion', '28.0.0')
Example:
https://github.com/react-native-community/react-native-maps/blob/master/lib/android/build.gradle
Hope it helps.
Upvotes: 2
Reputation: 18833
Add supportLibVersion = "28.0.0"
to buildscript
in android/build.gradle
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0" // <=== add this line
}
...
}
https://github.com/react-native-community/react-native-maps/issues/3108#issuecomment-552795543
Upvotes: 13
Reputation: 471
Add supportLibVersion = "28.0.0"
inside android/build.gradle
-> ext
example:
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
Upvotes: 47
Reputation: 1228
I solved this issue after these steps:
Add this line to \node_modules\react-native-maps\lib\android\build.gradle -- line: 20
def supportLibVersion = safeExtGet('supportLibVersion', '28.0.0')
In the AndroidManifest.xml
under <application>
:
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
Upvotes: 2
Reputation: 1
In your file build.gradle inside the android directory
(.../YourApp/android/build.gradle)
find the ext section and add
supportLibVersion = "28.0.0" ext { ... supportLibVersion = "28.0.0" }
that should do the work.
Upvotes: 0