Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with Android supportLibrary 28 #17

Open
joaom182 opened this issue Jun 15, 2019 · 0 comments
Open

Not working with Android supportLibrary 28 #17

joaom182 opened this issue Jun 15, 2019 · 0 comments

Comments

@joaom182
Copy link

joaom182 commented Jun 15, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant