jamesisaac / react-native-background-task

Periodic background tasks for React Native apps, cross-platform (iOS and Android), which run even when the app is closed.
MIT License
1.1k stars 110 forks source link

unable to link the project on window react native project #7

Open AbhishekNairTnex opened 7 years ago

AbhishekNairTnex commented 7 years ago

Hi I am trying to link the plugin but it keeps failing and giving me this error. I have installed these versions of the plugns "react-native-background-fetch": "^2.0.8", "react-native-background-task": "^0.2.0",

react-native link react-native-background-task Scanning 739 folders for symlinks in abcd\nodemodules (52ms) rnpm-install info Linking react-native-background-task android dependency rnpm-install info Android module react-native-background-task has been successfully linked rnpm-install info Linking assets to ios project rnpm-install ERR! Something went wrong while linking. Error: Expected "/ Begin ", "/ End ", "\"", or [A-Za-z0-9.] but "<" found. Please file an issue here: https://github.com/facebook/react-native/issues

Expected "/ Begin ", "/ End ", "\"", or [A-Za-z0-9_.] but "<" found.

This is my system configuraton. System platform win32 arch x64 cpu 4 cores Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz directory abcd

JavaScript node 7.10.0 npm 4.2.0 yarn 0.23.4

React Native react-native-cli 2.0.1 app rn version 0.44.0

Also i am getting these errors when i build the code after wrapping up the linking

abcd\android\app\src\main\java\com\tocdocdoctor\MainActivity.java:5: error: package com.jamesisaac.rnbackgroundtask does not exist import com.jamesisaac.rnbackgroundtask.BackgroundTaskPackage; ^ abdc\android\app\src\main\java\com\tocdocdoctor\MainApplication.java:6: error: package com.jamesisaac.rnbackgroundtask does not exist import com.jamesisaac.rnbackgroundtask.BackgroundTaskPackage; ^ abcd\android\app\src\main\java\com\tocdocdoctor\MainActivity.java:20: error: cannot find symbol BackgroundTaskPackage.useContext(this); ^ symbol: variable BackgroundTaskPackage location: class MainActivity abcd\android\app\src\main\java\com\tocdocdoctor\MainApplication.java:40: error: cannot find symbol new BackgroundTaskPackage(), ^ symbol: class BackgroundTaskPackage 4 errors :app:compileDebugJavaWithJavac FAILED

Can you suggest a method to sort this issue out?

regards Abhishek

jamesisaac commented 7 years ago

I'm not sure why the automatic linking process didn't work for you. Just tried on a clean project (also on Windows) with no issues. You can carry out the Android installation steps manually though, there's not much to change:

https://github.com/jamesisaac/RNBackgroundTaskExample/commit/718b3d2cfe1fa1a649ddb285be921ad8974dff26

And after that's done, you'll also need to do the manual step specified in the readme:

https://github.com/jamesisaac/RNBackgroundTaskExample/commit/160d0d424947e441b4d291bcad18d6441b1aa1a8

All the errors you pasted look like they're just because the linking wasn't fully completed.