react-native-background-geolocation: cannot find symbol com.facebook.react.ReactApplication

Hello!

I am having issues compiling the app when url 'https://maven.fabric.io/public' is part of my maven object in the root build.gradle.

Cannot find symbol com.facebook.react.ReactApplication and 23 other errors, all referencing this plugin.

I don’t know Java, so I am hoping I am just doing something in the wrong order.

Your Environment

  • Plugin version: 2.8.4
  • Platform: Android
  • OS version: 6.0
  • Device manufacturer / model: Nexus 6 API 23 (simulator)
  • React Native version (react-native -v): 0.46.4
  • Plugin config

Expected Behavior

App compiles.

Actual Behavior

App fails to compile with 24 errors (pasted at the bottom), starting with cannot find symbol com.facebook.react.ReactApplication

Steps to Reproduce

Here is my top level build.gradle file:


buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
            url 'https://maven.fabric.io/public'
        }
    }
}

removing url 'https://maven.fabric.io/public' makes the app build/work as expected.

Context

I need this line to make TwitterKit work as part of Fabric.

Debug logs

import com.facebook.react.ReactApplication;
                         ^
  symbol:   class ReactApplication
  location: package com.facebook.react
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:5: error: cannot find symbol
import com.facebook.react.ReactNativeHost;
                         ^
  symbol:   class ReactNativeHost
  location: package com.facebook.react
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:12: error: package com.facebook.react.jstasks does not exist
import com.facebook.react.jstasks.HeadlessJsTaskConfig;
                                 ^
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:13: error: package com.facebook.react.jstasks does not exist
import com.facebook.react.jstasks.HeadlessJsTaskContext;
                                 ^
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:14: error: package com.facebook.react.jstasks does not exist
import com.facebook.react.jstasks.HeadlessJsTaskEventListener;
                                 ^
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:87: error: cannot find symbol
public class RNBackgroundGeolocationEventReceiver extends BroadcastReceiver implements HeadlessJsTaskEventListener {
                                                                                       ^
  symbol: class HeadlessJsTaskEventListener
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:95: error: cannot find symbol
    private ReactNativeHost mReactNativeHost;
            ^
  symbol:   class ReactNativeHost
  location: class RNBackgroundGeolocationEventReceiver
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:96: error: cannot find symbol
    private HeadlessJsTaskContext mActiveTaskContext;
            ^
  symbol:   class HeadlessJsTaskContext
  location: class RNBackgroundGeolocationEventReceiver
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:176: error: cannot find symbol
    protected void startTask(final HeadlessJsTaskConfig taskConfig) {
                                   ^
  symbol:   class HeadlessJsTaskConfig
  location: class RNBackgroundGeolocationEventReceiver
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:196: error: cannot find symbol
    private void invokeStartTask(ReactContext reactContext, HeadlessJsTaskConfig taskConfig) {
                                                            ^
  symbol:   class HeadlessJsTaskConfig
  location: class RNBackgroundGeolocationEventReceiver
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:98: error: method does not override or implement a method from a supertype
    @Override
    ^
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:102: error: method does not override or implement a method from a supertype
    @Override
    ^
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:114: error: cannot find symbol
            ReactApplication reactApplication = ((ReactApplication) context.getApplicationContext());
            ^
  symbol:   class ReactApplication
  location: class RNBackgroundGeolocationEventReceiver
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:114: error: cannot find symbol
            ReactApplication reactApplication = ((ReactApplication) context.getApplicationContext());
                                                  ^
  symbol:   class ReactApplication
  location: class RNBackgroundGeolocationEventReceiver
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:147: error: cannot find symbol
            HeadlessJsTaskConfig config = new HeadlessJsTaskConfig(HEADLESS_TASK_NAME, event);
            ^
  symbol:   class HeadlessJsTaskConfig
  location: class RNBackgroundGeolocationEventReceiver
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:147: error: cannot find symbol
            HeadlessJsTaskConfig config = new HeadlessJsTaskConfig(HEADLESS_TASK_NAME, event);
                                              ^
  symbol:   class HeadlessJsTaskConfig
  location: class RNBackgroundGeolocationEventReceiver
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:153: error: cannot find symbol
                HeadlessJsTaskContext headlessJsTaskContext = HeadlessJsTaskContext.getInstance(reactContext);
                ^
  symbol:   class HeadlessJsTaskContext
  location: class RNBackgroundGeolocationEventReceiver
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:153: error: cannot find symbol
                HeadlessJsTaskContext headlessJsTaskContext = HeadlessJsTaskContext.getInstance(reactContext);
                                                              ^
  symbol:   variable HeadlessJsTaskContext
  location: class RNBackgroundGeolocationEventReceiver
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:185: error: cannot find symbol
                    reactInstanceManager.removeReactInstanceEventListener(this);
                                        ^
  symbol:   method removeReactInstanceEventListener(<anonymous ReactInstanceEventListener>)
  location: variable reactInstanceManager of type ReactInstanceManager
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:197: error: cannot find symbol
        HeadlessJsTaskContext headlessJsTaskContext = HeadlessJsTaskContext.getInstance(reactContext);
        ^
  symbol:   class HeadlessJsTaskContext
  location: class RNBackgroundGeolocationEventReceiver
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationEventReceiver.java:197: error: cannot find symbol
        HeadlessJsTaskContext headlessJsTaskContext = HeadlessJsTaskContext.getInstance(reactContext);
                                                      ^
  symbol:   variable HeadlessJsTaskContext
  location: class RNBackgroundGeolocationEventReceiver
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationModule.java:47: error: RNBackgroundGeolocationModule is not abstract and does not override abstract method onActivityResult(int,int,Intent) in ActivityEventListener
public class RNBackgroundGeolocationModule extends ReactContextBaseJavaModule implements ActivityEventListener, LifecycleEventListener {
       ^
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationModule.java:96: error: method does not override or implement a method from a supertype
    @Override
    ^
(path to app)MobileApp/node_modules/react-native-background-geolocation/android/src/main/java/com/transistorsoft/rnbackgroundgeolocation/RNBackgroundGeolocationModule.java:101: error: method does not override or implement a method from a supertype
    @Override
    ^
24 errors
:react-native-background-geolocation:compileReleaseJavaWithJavac FAILED

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (4 by maintainers)

Commits related to this issue

Most upvoted comments

In case anyone else is experiencing the same issue: make sure you correctly add new repositories. According to Android docs every maven repo should be in its own maven {} block.

That’s why

maven {
    // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
    url "$rootDir/../node_modules/react-native/android"
    url 'some new extra repo'
}

breaks dependencies. The correct version is

maven {
    // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
    url "$rootDir/../node_modules/react-native/android"
}
maven {
    url 'some new extra repo'
}

Update?