Project wont build. What should the gradle and project setup be with RNCamera? #1588
Comments
THIS IS NOT A SOLUTION - But, this can be solved by using an older version of react-native-camera. I was having the exact same issues as you did with a new react-native project, never ending compile errors with android studio such as those you mention. Revert what you upgraded in Android Studio (I'm using classpath 'com.android.tools.build:gradle:2.2.3' for example), or start a new project. Use an older version, such as "react-native-camera": "1.0.3" in package.json. Delete the old package and reinstall. This should compile properly for you. |
I created a fresh new project and installed react-native-camera@^1.0.3 and yet it still wont build. Apparently it needs something from google repos as I keep getting this error
If I add google() into the repos, the gradle 2.2.3 still can't find them. That could be bypassed by upgrading to gradle 3.0.0 or higher, but then I'd be in the start again. |
After a lot of time and getting help from a friend who knows a lot more than me about android:
and dependencies
in build.gradle
in gradle.properties
|
I met the same problem. |
EDIT: react-native-camera@^1.0.3 ---> change to react-native-camera@1.0.3. The arrow actually installs the latest version instead of 1.0.3. Make sure you delete the previous package. Original message This line inside the dependencies block in
These lines in
|
I created a yet another testproject to be sure there are no traces of the previous configuration.
But still I get the error saying I did some testing with the settings mentioned by @obsidianart but they didn't help either. No matter what I did the project building crashes to the same error saying it cannot find the google repos, even though they are clearly set in the build.gradle. I also noticed that the build process can not get past that even if there's no Android Virtual Device present. |
That's my buildscript section
And yes, I'm using the latest gradle |
Oh, okay. I need to test that later today. |
let me know if I can help in any other way. The problem I had was a little different (probably because I target a lowest device) but I hope my configuration can help. |
@timjam |
Hey, what are the issues you are currently facing? About the |
I haven't been able to test those other solutions yet, but I guess I already know what's the problem. The gradle folder in Windows is on default at C:\Users<user name>.gradle. I have some non-Ascii characters in my username and I can't change the user name from the user folder and gradle doesn't like non-ascii characters at all. So I need to figure out how I can change the gradle config to use some other folder than that default one. |
with I'm getting
|
@JakeRawr The warning is okay and you should definitely use 'andoid.enableAapt2=true'. Setting it to false will just hide possible "symptoms". Aapt2 is going to be the base builder in the future. The Aapt2 Error comes all the way from gradle. You can probably find more about this here: |
In case anyone's facing this issue on Android, please try the gradle upgrade guide. It worked for me. |
No any solution in internet working. why? in android studio 3.2.1 |
@sharibtanweer What have you tried so far? Upgrading to latest gradle should fix the issue. What's your setup? |
I just installed all the latest things: Android studio, react-native-cli, react-native-camera, system-images, gradles etc etc, but still I can't get react-native-camera work at all in any project. What is the preferred gradle and project configuration to get this package work?
Steps to reproduce
Now if you try to run react-native run-android you end up getting lots of errors. These I fixed with these solutions found from all over internet:
Added this snippet
to root's build.gradle file to remove this error
"Android dependency 'com.android.support:support-v4' has different version for the compile (23.0.1) and runtime (27.1.0) classpath. You should manually set the same version via DependencyResolution"
Then I added
android.enableAapt2=false
to gradle.properties, because I was getting this error:
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
At this point I figured out that
a) setting aapt to false doesn't actually fix the problem, but hides the cause and I have no idea what's the actual cause
b) maybe I am doing something completely wrong right from the beginning?
Does it work with Expo Camera?
I've managed to get Expo camera work. This problem is might not actually be a problem with the RNCamera itself, but rather it is not compatible with the latest gradle setups.
Expected behaviour
By following the instructions given on the installation part, one should be able to use the package in their projects
Actual behaviour
Project wont build
Environment
Node 9.8.0
npm 5.6.0
react-native 0.55.4
Android 6, Android 8
react-native-camera
react-native-camera 1.1.4
The text was updated successfully, but these errors were encountered: