Code Monkey home page Code Monkey logo

Comments (12)

Krammig avatar Krammig commented on May 11, 2024 3

@npomfret For what its worth, Gradle is a mystery to the whole world !!
The amount of time this thing consumes if trying to debug is absolutely ridiculous. I have had problem after problem with a fairly large project. Fix one thing and something else complains.
The incompatibilities between Gradle and Studio and other, the deprications, it's just crazy.
Yep you're right, I am not happy :)

By the way @npomfret and @vikeri thanks for the suggestions, didn't work for me unfortunately so I will keep running in circles.

from react-native-create-library.

gsunsnackv avatar gsunsnackv commented on May 11, 2024 3

@npomfret For what its worth, Gradle is a mystery to the whole world !!
The amount of time this thing consumes if trying to debug is absolutely ridiculous. I have had problem after problem with a fairly large project. Fix one thing and something else complains.
The incompatibilities between Gradle and Studio and other, the deprications, it's just crazy.
Yep you're right, I am not happy :)

By the way @npomfret and @vikeri thanks for the suggestions, didn't work for me unfortunately so I will keep running in circles.

I totally agree that gradle is piece of shit and should be erased from this world.

from react-native-create-library.

vikeri avatar vikeri commented on May 11, 2024 2

What I got working was the following:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    lintOptions {
       warning 'InvalidPackage'
    }
}

repositories {
    mavenCentral()
}

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

from react-native-create-library.

vikeri avatar vikeri commented on May 11, 2024 1

Yeah I had that exact issue, I do depend on com.facebook.react packages, but from what I saw the latest version on Maven is 0.20 and I used APIs that were newer than that. So I had to compile my project with an RN app in order to get the latest com.facebook.react jar from node_modules/react-native.

from react-native-create-library.

frostney avatar frostney commented on May 11, 2024

Hi @npomfret and thank you for using this tool. Would you mind checking if you installed the "Android Support Repository" in your Android SDK manager?

from react-native-create-library.

npomfret avatar npomfret commented on May 11, 2024

Yes, Android Support Repository is installed (version 35.0.0)

from react-native-create-library.

npomfret avatar npomfret commented on May 11, 2024

Any update on this? Has anyone managed the get the generated android project to work in android studio? How do you use it if not?

from react-native-create-library.

npomfret avatar npomfret commented on May 11, 2024

After much hacking around with the generated gradle file, I ended up with the following that seems to make android studio happy. The trick seems to be to tell gradle about jcenter, twice. Oh, and to tell gradle about gradle...

//this bit is new
build script {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.3'
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        idk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    lintOptions {
       warning 'InvalidPackage'
    }
}

//this bit is new
all projects {
    repositories {
        jcenter()
    }
}

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

I didn't want to submit it as a PR (yet) as I have no idea what the changes I've made actually mean. Gradle is a total mystery to me and I wouldn't want even to suggest this going in without some discussion.

from react-native-create-library.

npomfret avatar npomfret commented on May 11, 2024

Has anyone managed to get the java project working in Android studio without making these modifications to the generated gradle file?

from react-native-create-library.

vikeri avatar vikeri commented on May 11, 2024

I got the same error but couldn't get it to work with your gradle file either 😞

from react-native-create-library.

npomfret avatar npomfret commented on May 11, 2024

I've asked about setting up android build files that don't compile on a few other repos. It seems to me (in general) that a lot of react-native people just don't care about compiling java code in isolation of a project. People commonly build RN native libraries that just don't compile unless you embed them in another project... which seems like madness to me. In some RN library projects, most (maybe 99%) of the code has nothing to do with RN, its just pure java. And it should be compilable and testable in isolation in my opinion. But I don't know how to convince others of this. This project is a good example. I think everything in here would work IF you embedded the library you create into a fully functional RN project.

from react-native-create-library.

frostney avatar frostney commented on May 11, 2024

I just released version 3.0.0 which includes these fixes to the build.gradle file. Thank you for reporting the issue and investigating this πŸ‘

from react-native-create-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.