Skip to content

Not working with Android supportLibrary 28 #17

@joaom182

Description

@joaom182

This library is not compatible with Android supportLibrary 28.

On build will throw errors like:

error: resource android:attr/dialogCornerRadius not found.

Has two ways to fix this.

Edit build.gradle of react-native-location-switch project (not best solution).

+ def safeExtGet(prop, fallback) {
+    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
+ }

android {
-    compileSdkVersion 26
-    buildToolsVersion "26.0.1"
+    compileSdkVersion safeExtGet('compileSdkVersion', 26)
+    buildToolsVersion safeExtGet('buildToolsVersion ', "26.0.1")

    defaultConfig {
-        minSdkVersion 16
-        targetSdkVersion 26
+        minSdkVersion safeExtGet('minSdkVersion', 16)
+        targetSdkVersion safeExtGet('targetSdkVersion', 26)
        versionCode 1
        versionName computeVersionName()
    }
    lintOptions {
        abortOnError false
    }
}

Obviously is awful do this monkey patch, but you can use this library https://www.npmjs.com/package/patch-package to avoid problems on production build.

Or you can do this on your android/build.gradle of your project (best solution)

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion "28.0.3"
            }
        }
    }
}

I've submited a P.R #18

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions