naderio / nativescript-socket.io

Fully-featured Socket.IO client implementation for NativeScript
The Unlicense
48 stars 21 forks source link

Issue with include.gradle and keyword "compile" on NS 8 #81

Open ipald opened 2 years ago

ipald commented 2 years ago

Hello all, I cannot build my app for android anymore due to an issue in include.gradle file. I'm using NS8.1.4

The build fails with this error

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/ipald/Projects/my-app/platforms/tempPlugin/nativescript_socket.io/build.gradle' line: 137

* What went wrong:
A problem occurred evaluating root project 'nativescript_socket.io'.
> Could not find method compile() for arguments [io.socket:socket.io-client:1.+, build_5nh3wlr6x2bntajh43d81iz46$_run_closure6$_closure12@1d74c785] 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 1s
Failed to build plugin nativescript-socket.io : 
Error: Command ./gradlew failed with exit code 1

I've tried to change the keyword "compile" with "implementation" (or "api") and i'm able to step over the build ma Socket.io layer doesn't work

iOS build has no problems

Someone have a solution?

Dependencies: "@nativescript-community/ble": "3.0.29", "@nativescript-community/ui-material-bottomsheet": "^6.2.21", "@nativescript-community/ui-material-slider": "^6.2.23", "@nativescript/appversion": "^2.0.0", "@nativescript/camera": "^5.0.9", "@nativescript/core": "^8.1.4", "@nativescript/email": "^2.0.5", "@nativescript/firebase": "^11.1.3", "@nativescript/imagepicker": "^1.0.5", "@nativescript/iqkeyboardmanager": "^2.0.0", "@nativescript/local-notifications": "^5.0.3", "@nativescript/theme": "^3.0.2", "@nstudio/nativescript-checkbox": "^2.0.4", "@triniwiz/nativescript-toasty": "^4.1.3", "acorn": "^8.5.0", "ajv": "^8.10.0", "axios": "0.21.0", "geojson-tools": "^0.2.2", "lodash": "^4.17.21", "marked": "^3.0.8", "moment": "^2.29.1", "nativescript-app-shortcuts": "^3.0.0", "nativescript-dna-netservices": "^2.0.1", "nativescript-fonticon": "^2.0.2", "nativescript-nodeify": "^0.8.0", "nativescript-socket.io": "^0.11.1", "nativescript-speech-recognition": "^2.0.0", "nativescript-ui-autocomplete": "^8.0.0", "nativescript-ui-gauge": "^8.0.0", "nativescript-ui-listview": "^10.0.1", "nativescript-ui-sidedrawer": "^10.0.1", "nativescript-vibrate": "^4.0.1", "nativescript-vue": "^2.9.0", "promise-any-polyfill": "^1.0.1", "rxjs": "^7.3.1", "util": "^0.12.4", "util-inspect": "^0.1.8", "utils": "^0.3.1", "vue-moment": "^4.1.0", "vuex": "^3.6.2", "vuex-persistedstate": "^4.1.0"

ipald commented 2 years ago

I've found a solution

I changed the file platforms/android/include.gradle to

dependencies {
    // implementation (project(":library")) {
    //     transitive = true
    // }
    api ('io.socket:socket.io-client:1.+') {
      exclude group: 'org.json', module: 'json'
    }

}

Don't know why "implementation" doesn't work but after a session of trial-and-error and thanks to https://stackoverflow.com/questions/49515689/error-when-i-replace-compile-with-implementation-in-gradledependency I found out this solution but without the implementation part (that I left commented because I will proceed with a further investigation).

Due to the fact that this repo seems to be abandoned I've forked this project into https://github.com/ipald/nativescript-socket.io

nickolanack commented 2 years ago

changing compile to implementation did work for me