react-native-threads
react-native-threads copied to clipboard
Doesn't work with React-Native 0.60.5
I am following all the library installation steps listed here: https://github.com/joltup/react-native-threads/blob/master/README.md
But I have not managed to run this library in React-Native, I am using the dependencies:
"dependencies": { "react": "16.8.6", "react-native": "0.60.5", "react-native-threads": "0.0.16" }
In a new project using the react-native init MyAwesomeProject command, I would like to use this library since without multi thread an application is very limited in terms of data calculations.
Maybe you should put some error description (the wrong phenomenon or error log) here.
I'm getting the following error message:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings 15 actionable tasks: 2 executed, 13 up-to-date /home/aylan/Projects/thredtest/node_modules/react-native-threads/android/src/main/java/com/reactlibrary/ThreadBaseReactPackage.java:13: error: package com.facebook.react.modules.location does not exist import com.facebook.react.modules.location.LocationModule;
I have the same issue My dependencies:
"dependencies": { "react": "16.8.6", "react-native": "0.60.5", "react-native-threads": "0.0.16" }
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings 15 actionable tasks: 2 executed, 13 up-to-date /home/aylan/Projects/thredtest/node_modules/react-native-threads/android/src/main/java/com/reactlibrary/ThreadBaseReactPackage.java:13: error: package com.facebook.react.modules.location does not exist import com.facebook.react.modules.location.LocationModule;
+1
Clear solution to start threads (Android):
- react-native init MyProject
- npm i -S joltup/react-native-threads#master 3.create file react-native.config.js in project directory 4.insert this code to the file:
// react-native.config.js module.exports = { dependencies: { 'react-native-threads': { platforms: { android: null, // disable Android platform, other platforms will still autolink if provided }, }, }, };
- Open up android/app/src/main/java/[...]/MainApplication.java
- Add import com.reactlibrary.RNThreadPackage; to the imports at the top of the file
- Add packages.add(new RNThreadPackage(mReactNativeHost)); to getPackages method before return.
- Append the following lines to android/settings.gradle: include ':react-native-threads' project(':react-native-threads').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-threads/android')
- Insert the following lines inside the dependencies block in android/app/build.gradle: compile project(':react-native-threads')
Thanks @neller1 for your comment, its help me very much, but now I'm getting the follow error:

could anyone help me?
Thanks in advance