I upgraded my project with using React Native Upgrade Helper from 0.67.4 to 0.68.0 And I saw that Gradle versions upgraded, too.
When I try to run ./gradlew clean command in ./android file, it gives me that compile error.
A problem occurred evaluating project ':react-native-i18n'. > Could not find method compile() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. To check it, I created new react native project with 0.68.2 version. On first run with npm run android command, application worked as expected. But after I install react-native-i18n package;
npm install react-native-i18n --save
and run ./gradlew clean command again, it gave me same error again.
I replaced compile with implementation on ./node_modules folder and it fixed the error. But if I have lots of packages, should I replace all of packages' build.gradle files manually?
Root build.gradle:
... dependencies { classpath("com.android.tools.build:gradle:7.0.4") classpath("com.facebook.react:react-native-gradle-plugin") classpath("de.undercouch:gradle-download-task:4.1.2") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } ... gradle/wrapper/gradle-wrapper.properties file:
distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists Package.json:
... "dependencies": { "react": "17.0.2", "react-native": "0.68.2", "react-native-i18n": "^2.0.15" } ... Thanks.