OvalMoney / react-native-fitness

A React Native module to interact with Apple Healthkit and Google Fit.
MIT License
341 stars 68 forks source link

Could not find method compile() for arguments #116

Closed nunofmmarques closed 3 months ago

nunofmmarques commented 3 months ago

This error appears when i'm trying to build for android. I tried to replace compile for implementation but it gets the same error but for implementation. Any idea how to overcome this?


* Where:
Build file 'C:\xampp81\htdocs\react\BestApp\android\build.gradle' line: 21

* What went wrong:
A problem occurred evaluating root project 'qBest'.
> Could not find method compile() for arguments [project ':@ovalmoney_react-native-fitness'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 28s
Error: C:\xampp81\htdocs\react\BestApp\android\gradlew.bat exited with non-zero code: 1
Error: C:\xampp81\htdocs\react\BestApp\android\gradlew.bat exited with non-zero code: 1
    at ChildProcess.completionListener (C:\xampp81\htdocs\react\BestApp\node_modules\@expo\cli\node_modules\@expo\spawn-async\build\spawnAsync.js:52:23)
    at Object.onceWrapper (node:events:632:26)
    at ChildProcess.emit (node:events:517:28)
    at cp.emit (C:\xampp81\htdocs\react\BestApp\node_modules\@expo\cli\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1098:16)
    at ChildProcess._handle.onexit (node:internal/child_process:303:5)
    ...
    at Object.spawnAsync [as default] (C:\xampp81\htdocs\react\BestApp\node_modules\@expo\cli\node_modules\@expo\spawn-async\build\spawnAsync.js:17:21)
    at spawnGradleAsync (C:\xampp81\htdocs\react\BestApp\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:72:46)
    at Object.assembleAsync (C:\xampp81\htdocs\react\BestApp\node_modules\@expo\cli\build\src\start\platforms\android\gradle.js:52:18)
    at runAndroidAsync (C:\xampp81\htdocs\react\BestApp\node_modules\@expo\cli\build\src\run\android\runAndroidAsync.js:36:24)

I added the lines to settings.gradle

include ':@ovalmoney_react-native-fitness'
project(':@ovalmoney_react-native-fitness').projectDir = new File(rootProject.projectDir,   '../node_modules/@ovalmoney/react-native-fitness/android')

The build.gradle dependencies are looking like this

dependencies {
   classpath('com.android.tools.build:gradle')
   classpath('com.facebook.react:react-native-gradle-plugin')
   compile project(':@ovalmoney_react-native-fitness')
}

I'm using expo and I don't have a MainApplication.java, instead i have a MainApplication.kt, and looks like this

override fun getPackages(): List<ReactPackage> {
   // Packages that cannot be autolinked yet can be added manually here, for example:
   // packages.add(new MyReactNativePackage());
   packages.add(new RNFitnessPackage());
   return PackageList(this).packages
}

image