React Native : Task :react-native-maps:compileDebugRenderscript FAILED

后端 未结 5 570
伪装坚强ぢ
伪装坚强ぢ 2021-01-13 17:32

I am trying to implement React Native MapView for Android. I did follow github installation instruction but i am facing compilation error when i try to run usin

5条回答
  •  一整个雨季
    2021-01-13 18:34

    After 2 days I found the problem in my project. I changed the values of compileSdkVersion, supportLibVersion and playServicesVersion in android/build.gradle and android/app/build.gradle files to the same values as in node_modules/react-native-maps/lib/android/build.gradle and node_modules/react-native-maps/build.gradle files, this worked for me.

    Values of compileSdkVersion, supportLibVersion and playServicesVersion are same in all the below files.

    in android/build.gradle file:

    ...
    ext {
        compileSdkVersion   = 28
        targetSdkVersion    = 27
        buildToolsVersion   = "28.0.3"
        minSdkVersion       = 16
        supportLibVersion   = "28.0.0"
        playServicesVersion = "16.1.0" // or set latest version
        androidMapsUtilsVersion = "0.5+"
    }
    ...
    

    in android/app/build.gradle file:

    ...
    android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "com.reactnativeapp2"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    ...
    ...
    }
    ...
    dependencies {
       ...
       ...
       implementation 'com.google.android.gms:play-services-base:16.1.0'
       implementation 'com.google.android.gms:play-services-maps:16.1.0'
    }
    ...
    

    in node_modules/react-native-maps/lib/android/build.gradle file:

    ...
    android {
      compileSdkVersion safeExtGet('compileSdkVersion', 28)
    
      defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', 16)
        targetSdkVersion safeExtGet('targetSdkVersion', 27)
      }
    }
    
    
    dependencies {
      ...
      implementation "com.android.support:appcompat-v7:${safeExtGet('supportLibVersion', '28.0.0')}"
      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'
    }
    ...
    

    in node_modules/react-native-maps/build.gradle file:

    ...
    ext {
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = '28.0.0'
        playServicesVersion = '16.1.0'
      }
    ...
    

提交回复
热议问题