OpenNative / open-native

Open Native brings cross-platform communities together to help them collaborate and strengthen each other through development diversity.
https://open-native.org/
MIT License
454 stars 8 forks source link

No signature of method: before_plugins_f31qds46uanbzcp13ta91b9jm.ext() #13

Closed cristiandaulisio closed 1 year ago

cristiandaulisio commented 1 year ago

Hello, i followed your guide but when i launch the project i receive:

`before-plugins.gradle' line: 1 A problem occurred evaluating script.

No signature of method: before_plugins_f31qds46uanbzcp13ta91b9jm.ext() is applicable for argument types: (before_plugins_f31qds46uanbzcp13ta91b9jm$_run_closure1) values: [before_plugins_f31qds46uanbzcp13ta91b9jm$_run_closure1@59cc70c9]

Possible solutions: exec(groovy.lang.Closure), exec(org.gradle.api.Action), wait(), run(), run(), any()

Unable to apply changes on device: 2c9edbb29804. Error is: Command gradlew.bat failed with exit code 1.  [NSDebugAdapter] The tns command finished its execution with code 0.`

vallemar commented 1 year ago

@Atomico001 What react native plugin are you using? can you pass the link? Thank you!

cristiandaulisio commented 1 year ago

@vallemar Thank you for answer At this moment i installed only the open-native plugin followed the guide in this github Readme. But i receive that error.

The final goal is to install https://github.com/MacKentoch/react-native-beacons-manager

ammarahm-ed commented 1 year ago

Hey @Atomico001 Can you share your before-plugins.gradle file?

cristiandaulisio commented 1 year ago

Hey @Atomico001 Can you share your before-plugins.gradle file?

ext {
        // The version used here should be same as the one's
        // set in app.gradle file.
         buildToolsVersion = '33.0.0'
        minSdkVersion = 23
        targetSdkVersion 30
    compileSdkVersion 31

        androidXCoreVersion = "1.8.0"
        androidXCompatVersion = "1.5.1"
}
allprojects {

  // Nativescript by default runs this hook for all plugin builds,
  // but we want to run it only when the main app builds.
  if (!rootProject.projectDir.absolutePath.contains("tempPlugin")) {
    // We are replacing com.facebook.react:react-native with our local :react library in all linked libraries.
    // We could do this inside the module itself but we want the module to work in both
    // react-native & nativescript
    configurations {
      all {
        resolutionStrategy {
          dependencySubstitution {
            substitute module("com.facebook.react:react-native") using project(":react") because "we will replace this with our local react"
          }
        }
      }
    }
  }
}
ammarahm-ed commented 1 year ago

Hey, use this below, the above has some mistakes:

ext {
        // The version used here should be same as the one's
        // set in app.gradle file.
         buildToolsVersion = '31.0.0'
         minSdkVersion = 23
         targetSdkVersion = 30
         compileSdkVersion = 31
         androidXCoreVersion = "1.3.1"
         androidXCompatVersion = "1.3.1"
}
allprojects {

  // Nativescript by default runs this hook for all plugin builds,
  // but we want to run it only when the main app builds.
  if (!rootProject.projectDir.absolutePath.contains("tempPlugin")) {
    // We are replacing com.facebook.react:react-native with our local :react library in all linked libraries.
    // We could do this inside the module itself but we want the module to work in both
    // react-native & nativescript
    configurations {
      all {
        resolutionStrategy {
          dependencySubstitution {
            substitute module("com.facebook.react:react-native") using project(":react") because "we will replace this with our local react"
          }
        }
      }
    }
  }
}

The app is building fine on my side.

cristiandaulisio commented 1 year ago

@ammarahm-ed The error is changes but about the same.

\before-plugins.gradle' line: 23 A problem occurred evaluating script. No signature of method: org.gradle.api.internal.artifacts.ivyservice.dependencysubstitution.DefaultDependencySubstitutions$1.using() is applicable for argument types: (org.gradle.internal.component.local.model.DefaultProjectComponentSelector) values: [project :react] Possible solutions: find(), print(java.io.PrintWriter), print(java.lang.Object), use([Ljava.lang.Object;), find(groovy.lang.Closure), wait()

Command gradlew.bat failed with exit code 1

ammarahm-ed commented 1 year ago

What version of Nativescript are you using? also do ns clean once then try again.

cristiandaulisio commented 1 year ago

ns info ✔ Getting NativeScript components versions information... ⚠ Update available for component nativescript. Your current version is 8.2.3 and the latest available version is 8.4.0. ⚠ Update available for component @nativescript/core. Your current version is 8.1.5 and the latest available version is 8.4.1. ⚠ Update available for component @nativescript/ios. Your current version is 8.1.0 and the latest available version is 8.4.0. ⚠ Update available for component @nativescript/android. Your current version is 8.1.1 and the latest available version is 8.4.0.

i did a ns clean but nothing changed

vallemar commented 1 year ago

@Atomico001 try update all dependencies of ns

ammarahm-ed commented 1 year ago

@Atomico001 can you upgrade your project to 8.4.0? It works properly on 8.4.0 & above.

cristiandaulisio commented 1 year ago

Ok, i will updated everything.. (hard job) now i succesfull installed open-native and now it builds finally!

so i installed the plugin goal https://github.com/MacKentoch/react-native-beacons-manager and now when i build i have this error:

node_modules\react-native-beacons-manager\android\build.gradle' line: 30
A problem occurred evaluating project ':react-native-beacons-manager'.
Could not find method compile() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Command gradlew.bat failed with exit code 1
app.gradle:
    buildToolsVersion = '33.0.0'
    minSdkVersion 23
    targetSdkVersion 33
    compileSdkVersion 33

so i used this before-plugins.gradle:

    ext {
        // The version used here should be same as the one's
        // set in app.gradle file.
        buildToolsVersion = '33.0.0'
        minSdkVersion = 23
        compileSdkVersion = 33
        targetSdkVersion = 33

        androidXCoreVersion = "1.8.0"
        androidXCompatVersion = "1.5.1"
}
allprojects {

  // Nativescript by default runs this hook for all plugin builds,
  // but we want to run it only when the main app builds.
  if (!rootProject.projectDir.absolutePath.contains("tempPlugin")) {
    // We are replacing com.facebook.react:react-native with our local :react library in all linked libraries.
    // We could do this inside the module itself but we want the module to work in both
    // react-native & nativescript
    configurations {
      all {
        resolutionStrategy {
          dependencySubstitution {
            substitute module("com.facebook.react:react-native") using project(":react") because "we will replace this with our local react"
          }
        }
      }
    }
  }
}
ammarahm-ed commented 1 year ago

I was getting the same error actually now. The module itself is pretty outdated. Last updates in 2017 😅 i have gotten it to work btw locally. Just need to fix something in open-native after which i will post the steps here to follow.

ammarahm-ed commented 1 year ago

Hey, so follow the steps below once I release alpha.15:

Install the module from here:

npm install @hkpuits/react-native-beacons-manager

Add the following patch in patches/@hkpuits+react-native-beacons-manager+1.2.7.patch. Use patch-package to install the patch. Mainly you need to add postinstall:"patch-package" in scripts inside package.json.

diff --git a/node_modules/@hkpuits/react-native-beacons-manager/android/src/main/AndroidManifest.xml b/node_modules/@hkpuits/react-native-beacons-manager/android/src/main/AndroidManifest.xml
index a7e2244..f186903 100755
--- a/node_modules/@hkpuits/react-native-beacons-manager/android/src/main/AndroidManifest.xml
+++ b/node_modules/@hkpuits/react-native-beacons-manager/android/src/main/AndroidManifest.xml
@@ -8,9 +8,9 @@
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

     <application>
-        <service android:name="com.mackentoch.beaconsandroid.BeaconsAndroidTransitionService"/>
+        <service android:exported="true" android:name="com.mackentoch.beaconsandroid.BeaconsAndroidTransitionService"/>

-        <receiver android:name="com.mackentoch.beaconsandroid.BeaconsAndroidBootReceiver">
+        <receiver android:exported="true" android:name="com.mackentoch.beaconsandroid.BeaconsAndroidBootReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>

In nativescript.config.js:

export default {
 ...
  'open-native': {
    patchAndroidApplication: true,
  },
} as NativeScriptConfig;

Run the app & it should build normally. This will work in alpha.15 that I will release in a bit.

ammarahm-ed commented 1 year ago

Hey @Atomico001 alpha.16 is out. Please follow the updated setup guide for android: https://github.com/OpenNative/open-native/tree/main/packages/core

Then do the above mentioned steps to get it to build with the module installed.

cristiandaulisio commented 1 year ago

Perfect. i will try. Thank you for you effort!

cristiandaulisio commented 1 year ago

Ok, i follow all instruction. It build. From your instruction now i can use the module without problem.

so i follow the readme and:

import Beacons from '@hkpuits/react-native-beacons-manager'

the problem is that i receive: ...node_modules/@hkpuits/react-native-beacons-manager/typings/react-native-beacons-manager.d.ts' is not a module.ts(2306)

Don't know if it is a module problem or something with openNative.

ammarahm-ed commented 1 year ago

Try importing as follows: import Beacons from '@hkpuits/react-native-beacons-manager/index.js'.