Comments (12)
@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.
@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.
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.
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.
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.
Yes, Android Support Repository is installed (version 35.0.0)
from react-native-create-library.
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.
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.
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.
I got the same error but couldn't get it to work with your gradle file either π
from react-native-create-library.
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.
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)
- Any plans to create native modules with a view component? HOT 4
- when there is no library's name with this cli, exception handling is needed
- Is this project dead ? HOT 7
- iOS module not importable after install HOT 6
- How can I create a βreact nativeβ library in Windows that is developed locally?
- React Native Library for TV HOT 1
- .podspec file is created in ios folder HOT 1
- Library
- Does anyone now how to install react-navigation in the library project?
- Just Use create-react-native-library
- error: bundling failed: ambiguous resolution: module .../index.js tries to require react-native, but there are several files providing this module. You can delete or fix them HOT 2
- Any suggested guide to building a native module using this lib(Question)
- [Feature Request] Provide test template.
- Whats the process of creating a module with cocoapods dependency HOT 1
- Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
- examples_postinstall removes wrong files
- Cannot open the generated ios workspace HOT 6
- Trailing whitespace in generated library project
- --generate-example does not work with no yarn installed
- [minor] does not show correct directory name at the end
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-create-library.