React-native-camera: `compileOnly` introduces gradle 3 dependency

Created on 16 Apr 2018  路  3Comments  路  Source: react-native-camera/react-native-camera

Hello,

Just spent some time debugging this. so wanted to share my learnings in case anyone else runs into a similar issue. Looks like the compileOnly syntax introduced in https://github.com/react-native-community/react-native-camera/commit/1c7f231af460127bebf1f9970367bf64987de34b means folks need to upgrade their projects to gradle 3.

That will involve changing buildscript -> dependencies -> classpath to something like 'com.android.tools.build:gradle:3.0.1'

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

When I did that I started getting errors about some modules not expecting some version of com.android.support.

````sh

Android dependency 'com.android.support:exifinterface' has different version for the compile (25.4.0) and runtime (27.1.0) classpath. You should manually set the same version via DependencyResolution
````

Adding this bit fixed it for me:

subprojects { project.configurations.all { resolutionStrategy.eachDependency { details -> if (details.requested.group == 'com.android.support' && !details.requested.name.contains('multidex') ) { details.useVersion "27.1.0" } } } }

Hope that helps others!

All 3 comments

we've been using gradle 3 for a while

it is already on the docs, it should be fine

Hi @sibelius , where is it mentioned in the docs?

@MLDimitry you can follow react-native-maps docs for now

feel free to send a PR improving the docs

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aiibe picture aiibe  路  3Comments

grkemtneri picture grkemtneri  路  3Comments

WarrenBuffering picture WarrenBuffering  路  3Comments

masrc picture masrc  路  3Comments

nonameolsson picture nonameolsson  路  3Comments