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

Build Error on Android Devices #14

Open
ochikov opened this issue Jul 23, 2019 · 5 comments
Open

Build Error on Android Devices #14

ochikov opened this issue Jul 23, 2019 · 5 comments

Comments

@ochikov
Copy link

ochikov commented Jul 23, 2019

Hello,
I am getting build error with the following error:

A problem occurred configuring project ':react-native-os'.
> compileSdkVersion is not specified.`A problem occurred configuring project ':react-native-os'.
> compileSdkVersion is not specified.

My gradle configuration is:

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.gms:google-services:4.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}
@marcusleeeugene
Copy link

marcusleeeugene commented Jul 24, 2019

Met with the exact same problem, couldn't find solutions anywhere.. Have you tried looking into the react-native-os library gradle file? I'm not sure what to change but I think it might be because of the specified sdk/build versions in the library

@marcusleeeugene
Copy link

marcusleeeugene commented Jul 26, 2019

@ochikov Hey, I think I found a fix for this. I'm not sure why but the safeExtGet didn't work for me. So i commented them out, and did the normal declaration for the exact same sdk versions. Here's how my code looks like. Hopefully it works for you too.

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

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
    }
}

apply plugin: 'com.android.library'

android {
    //safeExtGet('compileSdkVersion', 23)
    //safeExtGet('buildToolsVersion', '23.0.1')
    compileSdkVersion 23
    buildToolsVersion '23.0.1'

    defaultConfig {
        //safeExtGet('minSdkVersion', 16)
        //safeExtGet('targetSdkVersion', 22)
        minSdkVersion 16
        targetSdkVersion 22

        versionCode 1
        versionName "0.2.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    // needed for https://github.com/square/okio/issues/58
    lintOptions {
        abortOnError false
        warning 'InvalidPackage'
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.facebook.react:react-native:+'

}

@ochikov
Copy link
Author

ochikov commented Jul 26, 2019 via email

@Tbaut
Copy link

Tbaut commented Aug 1, 2019

edit: Thanks, that worked.

@Jerd22
Copy link

Jerd22 commented Jun 6, 2022

file '\node_modules\react-native-os\android\build.gradle' line: 51

dependencies {
    compile 'com.facebook.react:react-native:+'
}

change to

dependencies {
    api 'com.facebook.react:react-native:+'
}

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

4 participants