Giter Site home page Giter Site logo

Comments (17)

ammarahm-ed avatar ammarahm-ed commented on May 22, 2024 1

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.

from open-native.

ammarahm-ed avatar ammarahm-ed commented on May 22, 2024 1

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.

from open-native.

ammarahm-ed avatar ammarahm-ed commented on May 22, 2024 1

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.

from open-native.

cristiandaulisio avatar cristiandaulisio commented on May 22, 2024 1

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

from open-native.

vallemar avatar vallemar commented on May 22, 2024

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

from open-native.

cristiandaulisio avatar cristiandaulisio commented on May 22, 2024

@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

from open-native.

ammarahm-ed avatar ammarahm-ed commented on May 22, 2024

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

from open-native.

cristiandaulisio avatar cristiandaulisio commented on May 22, 2024

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"
          }
        }
      }
    }
  }
}

from open-native.

ammarahm-ed avatar ammarahm-ed commented on May 22, 2024

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.

from open-native.

cristiandaulisio avatar cristiandaulisio commented on May 22, 2024

@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

from open-native.

ammarahm-ed avatar ammarahm-ed commented on May 22, 2024

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

from open-native.

cristiandaulisio avatar cristiandaulisio commented on May 22, 2024

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

from open-native.

vallemar avatar vallemar commented on May 22, 2024

@Atomico001 try update all dependencies of ns

from open-native.

ammarahm-ed avatar ammarahm-ed commented on May 22, 2024

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

from open-native.

cristiandaulisio avatar cristiandaulisio commented on May 22, 2024

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"
          }
        }
      }
    }
  }
}

from open-native.

cristiandaulisio avatar cristiandaulisio commented on May 22, 2024

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.

from open-native.

ammarahm-ed avatar ammarahm-ed commented on May 22, 2024

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

from open-native.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.