react-native-android-open-settings icon indicating copy to clipboard operation
react-native-android-open-settings copied to clipboard

Could not find method implementation() for arguments [com.facebook.react:react-native:+]

Open leeleoo opened this issue 5 years ago • 5 comments

"react-native": "^0.54.3",
"react-native-android-open-settings": "^1.2.0",
  • What went wrong: A problem occurred evaluating project ':react-native-android-open-settings'.

Could not find method implementation() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

in node_modules/react-native-android-open-settings/android/build.gradle

modify

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

to

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

and it works

leeleoo avatar Dec 06 '18 04:12 leeleoo

I've had a bit different error message, but it helped, thanks!

MainApplication.java:6: error: package com.levelasquez.androidopensettings does not exist
import com.levelasquez.androidopensettings.AndroidOpenSettingsPackage;
                                          ^
MainApplication.java:59: error: cannot find symbol
            new AndroidOpenSettingsPackage(),
                ^
  symbol: class AndroidOpenSettingsPackage

effektsvk avatar Jan 28 '19 12:01 effektsvk

@leeleoo but when you install your packages again or update them, your local change will be gone. You are using an older Android API level, right?

donni106 avatar Mar 05 '19 13:03 donni106

@donni106 That's why I made a fork, but now that I think about it a patch would be probably a better idea. AFAIK this is problem in gradle, not Android API level. compile is deprecated since gradle version 3, and I'm currently using 2.3.3 (classpath 'com.android.tools.build:gradle:2.3.3' in android/build.gradle)

effektsvk avatar Mar 05 '19 13:03 effektsvk

Yes sure, gradle version, not Android API level, my fault.

donni106 avatar Mar 05 '19 16:03 donni106

@donni106 yes and I update gradle version to 3.x

leeleoo avatar Mar 08 '19 12:03 leeleoo