Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot find symbol com.facebook.react.ReactApplication #294

Closed
dscx opened this issue Jul 26, 2017 · 15 comments
Closed

cannot find symbol com.facebook.react.ReactApplication #294

dscx opened this issue Jul 26, 2017 · 15 comments

Comments

@dscx
Copy link

dscx commented Jul 26, 2017

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
@christocracy
Copy link
Member

Link to this TwitterKit plugin please.

@dscx
Copy link
Author

dscx commented Jul 26, 2017

@christocracy https://dev.twitter.com/twitterkit/android/installation

That particular maven line isn't mentioned anywehre in the official docs, but I found itin this article, firebase/FirebaseUI-Android#392, without which the app cant find twitter at all.

I am hoping I am just doing something dumb!

FWIW I understand this might not even be your plugin causing the issue, but weird coincidence. Also I am not very familiar with the Android ecosystem at this depth.

@dscx
Copy link
Author

dscx commented Jul 27, 2017

I maybe should also note I am running without a license for now. Once I verify it all works we will be purchasing a license.

@christocracy
Copy link
Member

This has nothing to do with license. Your app is unable to locate a number of classes in the React package.

@dscx
Copy link
Author

dscx commented Jul 27, 2017

@christocracy so you think that the even though it references your library as the culprit files, it is not actually your library? Darn.

@christocracy
Copy link
Member

Try removing my lib and compile. Are you using any other native components? Show me you other components you're using.

@christocracy
Copy link
Member

Update?

Lida pushed a commit to livecirrus/react-native-background-geolocation that referenced this issue Nov 15, 2017
…estroy

Refactor Android onDestroy; Implementing Android Location Authorization
@hssrrw
Copy link

hssrrw commented Nov 28, 2017

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

@phantom1299
Copy link

@hssrrw thanks man, saved me some precious time!

@PARAGJYOTI
Copy link

@hssrrw you rock man !

@cuongdcdev
Copy link

@hssrrw thanks! you saved my day

@asanz8
Copy link

asanz8 commented Jun 26, 2018

@hssrrw You saved my day!

@solaomosola
Copy link

@hssrrw - You rock 💯

@Balajipss
Copy link

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

You are a rockstar bro

@RhamHarts
Copy link

I have a problem that is almost similar to this. I made an android project from react native and expo. when I try to build the application the error appears like this


> Task :app:compileDebugJavaWithJavac
D:\Projek Data posyandu\New folder\amonisasi\android\app\src\main\java\com\hamirz\amonisasi\MainActivity.java:3: error: cannot find symbol
import com.hamirz.amonisasi.BuildConfig;
                           ^
  symbol:   class BuildConfig
  location: package com.hamirz.amonisasi
D:\Projek Data posyandu\New folder\amonisasi\android\app\src\main\java\com\hamirz\amonisasi\MainApplication.java:3: error: cannot find symbol
import com.hamirz.amonisasi.BuildConfig;
                           ^
  symbol:   class BuildConfig
  location: package com.hamirz.amonisasi
D:\Projek Data posyandu\New folder\amonisasi\android\app\src\main\java\com\hamirz\amonisasi\MainActivity.java:40: error: cannot find symbol
    return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate(                                                  ^
  symbol:   variable BuildConfig
  location: class MainActivity
D:\Projek Data posyandu\New folder\amonisasi\android\app\src\main\java\com\hamirz\amonisasi\MainApplication.java:28: error: 
cannot find symbol
        return BuildConfig.DEBUG;
               ^
  symbol: variable BuildConfig
D:\Projek Data posyandu\New folder\amonisasi\android\app\src\main\java\com\hamirz\amonisasi\MainApplication.java:47: error: 
cannot find symbol
        return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
               ^
  symbol: variable BuildConfig
D:\Projek Data posyandu\New folder\amonisasi\android\app\src\main\java\com\hamirz\amonisasi\MainApplication.java:52: error: 
cannot find symbol
        return BuildConfig.IS_HERMES_ENABLED;
               ^
  symbol: variable BuildConfig
D:\Projek Data posyandu\New folder\amonisasi\android\app\src\main\java\com\hamirz\amonisasi\MainApplication.java:65: error: 
cannot find symbol
    if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
        ^
  symbol:   variable BuildConfig
  location: class MainApplication
D:\Projek Data posyandu\New folder\amonisasi\android\app\src\main\java\com\hamirz\amonisasi\MainApplication.java:65: error: 
illegal parenthesized expression
    if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
       ^
8 errors

> Task :app:compileDebugJavaWithJavac FAILED
w: Detected multiple Kotlin daemon sessions at build\kotlin\sessions

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

what i already tried :
1.)i already tried to change the gradle version from 7.5.1 which is default from folder to 8.2.1 newest version.

2.)try to compatible the java version with kotlin version.

and the same error still appear like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants