cannot compile this project: "cannot find symbol import com.facebook.react.bridge.BaseActivityEventListener"
See original GitHub issueIf i run:
./gradlew clean build
I get:
/Users/nickpomfret/Documents/github/react-native-image-picker/android/src/main/java/com/imagepicker/ImagePickerActivityEventListener.java:6: error: cannot find symbol
import com.facebook.react.bridge.BaseActivityEventListener;
^
symbol: class BaseActivityEventListener
location: package com.facebook.react.bridge
Anyone know what’s going on?
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (14 by maintainers)
Top Results From Across the Web
error: cannot find symbol import com.facebook.react.bridge ...
2.patch file in the project that I don't remember adding, so I don't know if that has something to do with it.
Read more >Android Native Modules
You can find your Android project here within a React Native app: ... import com.facebook.react.bridge.NativeModule;
Read more >How to fix this error I get when importing kotlin package into ...
I'm building a react native app that uses the ... import com.facebook.react.bridge. ... error: cannot find symbol import com.rncamera0.
Read more >React-Native Compile Error: Cannot Find Symbol - ADocLib
Solvedreact native firebase RNFirebaseInvites error: cannot find symbol ... cannot compile this project: cannot find symbol import com.facebook.react.bridge ...
Read more >Native Modules - React Native
Sometimes an app needs access to a platform API that React Native doesn't have a ... ReactContextBaseJavaModule; import com.facebook.react.bridge.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hi @marcshilling @npomfret , there has been a lot of discussion on this issue and I thought I will share my two cents because I ran into a similar thing with a different project to which I was adding some features and wanted to build it outside of my react-native application to cut down on the time before I find compilation errors and such. I am not an expert in react-native and I think you guys have a far better understanding of the inner workings of react-native than me, so please correct me if I am wrong.
I think the reason that the app compiles fine and these independent modules don’t compile out of the box even though for both, the build.gradle states the dependency on
react-native
ascompile "com.facebook.react:react-native:+" // From node_modules
is what is present in thebuild.gradle
in theandroid
directory. If you notice, in your react-native application, you have two build.gradle files, one inandroid/app
directory which is the build.gradle for your app and one inandroid
directory which contains some configuration which gets applied to all the projects. In that build.gradle, we specify the android specific react-native stuff to get from the local copy of react-nativeurl "$rootDir/../node_modules/react-native/android"
, so it doesn’t even go to maven to get the published copy of react-native. I think if you were to copy over the contents of this build.gradle, mainlyto this modules build.gradle, make sure that the url points to valid relative location (this could reference the react-native module in your app or a forked copy of react-native etc., run gradlew clean and build the project again, it should build. I haven’t tried it with this project but have tried it with others and they build fine after I do the above. I think the reason, other RN modules that you mentioned compiles without any problem is that they are not implementing the
ActivityEventListener
interface which has changed over time more importantly since react-native 0.21 due to which you don’t see the compilation errors in those projects that you see here.Aaaargh, the point is THEY ALL COMPILE! And they compile on their own, without an enclosing project. They have a build that works, why is that so controversial?