Success build will occur.
FAILURE: Build failed with an exception.
Where:
Build file '/Users/shouhuasun/dev/image-words/mobile/node_modules/react-native-share/android/build.gradle' line: 53What went wrong:
A problem occurred evaluating project ':react-native-share'.Could not find method compileOnly() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Version: 1.1.0
Hi, this is because of your Gradle. you must use Gradle 3+. Please upgrade your gradle. If you are using latest React native 0.56.0 then do these basic steps:
Update gradle version in android/gradle/wrapper/gradle-wrapper.properties :
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Modify android/build.gradle under dependencies:
classpath 'com.android.tools.build:gradle:3.1.0'
+1 on this issue. Tried to follow @yeomann steps, didn't work.
Hi @luco thank for comment. i have produced a sample repo, you can check all the working configs and settings.
https://github.com/yeomann/react-native-share-android-test
Please note following that
you have neccessary tools installed for android such as SDK and build tools with 27
as mentioned in build.gradle
buildToolsVersion = "27.0.3"
minSdkVersion = 19
compileSdkVersion = 27
targetSdkVersion = 27
supportLibVersion = "27.1.1"
Also note that i am using react-native 0.56.0 that is latest for now, with upgraded gradle 3+ with 4.4 distributions distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Most helpful comment
Hi, this is because of your Gradle. you must use Gradle 3+. Please upgrade your gradle. If you are using latest React native 0.56.0 then do these basic steps:
Update gradle version in
android/gradle/wrapper/gradle-wrapper.properties:Modify
android/build.gradleunderdependencies: