-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Android] [0.68.0] Cannot find symbols for new architecture upgrade #33623
Comments
Try adding this to imports in
Note: where is |
I've run into the same issue when running react-native upgrade. Suggestion with BuildConfig didn't help and also wasn't really found here: https://react-native-community.github.io/upgrade-helper/?from=0.67.2&to=0.68.1 |
In my case react native upgrade had failed to upgrade
|
@finnp Ummm I'm gonna give your trick a try - will let you know |
@finnp where'd you get this from and where does it go? I don't see
|
As @finnp and @swrobel already mentioned, the issue is that you bumped your RN version to 0.68 without using You need to edit your Closing as this looks resolved, feel free to reopen if this is not the case. |
the diff can b a bit... iffy at times 😅 here's what we want https://react-native-community.github.io/upgrade-helper/?from=0.65.1&to=0.69.0-rc.0 to enable
from
if that helps clarify @swrobel |
I don't understand. Getting this same error out of nowhere, because I was already working with RN 68.1. I was able to run the Android app and to generate AAB and APK files. With all the stuff that gets auto generated it's imposible for me to say when and where this started happening. Solutions stated above are somewhat obscure
What is this? Where would you place it? Is there a code snippet to point you exactly WHERE AND HOW? Why is this issue closed? I haven't found a clear solution yet, neither @swrobel seems yo have gotten a response back... |
Your
This is a buildConfigField from Android. You can read more about it here: It's needed to be placed inside your This is necessary if you enable the New Architecture as it will tell the runtime if you enabled or not the
This issue is closed because, as I previously said, the upgrade process was not followed properly. We have the Upgrade Helper tool that explains steps by steps how to update your files and setup. If some of those steps are missed (i.e. you forget to edit a build.gradle file) things will not work properly. I hope this clarifies @piscespieces |
I had a similar issue, but unrelated to upgrading. Nonetheless I had a similar fix. Instead of |
|
This work for me perfectly, And I was not updating, just a new project |
I updated RN from 0.70.4 to 0.71.2 and I'm facing this issue
NOTE: Ok, got it. The error was caused because in android/app/build.gradle the applicationId got the name wrong, so yeah, pay attention to the name so that it's the same as the original.:
|
Thank you @hadnet our issue was the namespace should not be the same as applicationId. namespace needs to be same as the value used at top of MainActivity.java, MainApplication.java, and ReactNativeFlipper.java for the package. so importing BuildConfig in MainApplication.java is not needed |
important thing, if you have changed the project name be sure to delete |
Hi everyone.
|
Seems like having the same value for namespace and applicationId was causing the issue in my project too. I tried so many things but nothing else worked for me. |
Solved this issue by setting correct namespace value, in my case i had |
I started an expo project, ejected and the ReactNativeFlipper.java had the namespace specified as package, but MainActivity.java and MainApplication.java had the applicationId specified as package. Changing it to the package name (Not the applicationId!) everywhere fixed it. Note that I had two ReactNativeFlipper.java files in my android folder and changed both. |
This worked for me. My sleep got saved. |
You're right, I just noticed this started happening right after changing my app thanks! |
Check the namespace value in app/build.gradle . For me fixing the namespace to the package name of the app fixed the issue. Hope it helps others. |
Excellent! But in my case the applicationId is dynamic, it is different for debug and release builds so how do I give the namespace a dynamic value rather than a static value?
|
@akshitrcrm, that was my issue too.... Here's a great video with the solution Check to make sure your namespace and packages names are correct. |
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
what i already tried : 2.)try to compatible the java version with kotlin version. and the same error still appear like this. |
Still have this issue. My namespaces, packages, and imports are all correct and matching. npx expo run:android works, but building or running the release version crashes with the ReactNativeFlipper cannot find symbol error. Ive been stuck on this for the past week and still can't figure it out... |
I have noticed that building the project in the 'debug' variant creates a BuildConfig.java which builds and runs smoothly - but when building with the 'release' variant the BuildConfig.java is not created - which creates the error. Any ideas on this? Been stuck on it for a couple weeks... |
Yeah this is the solution, thank you |
@joshAntoniuk I encountered the same issue as you. To fix this issue I've added buildConfigField in the defaultConfig found in "android\app\build.gradle" like this:
Then I've added an import where the BuildConfig fields are used. In my case I've to add the import to MainApplication.java and AppProvider.java like this:
Hope this will help someone getting stuck. :) |
Solution Found - : https://stackoverflow.com/a/77428914/16116610 |
I just came across this after updating from 0.69 to 0.72. Couldn't solve it so installed a fresh RN app and saw that there was no |
New Version
0.68.0
Old Version
0.65.1
Build Target(s)
Android - Pixel 4 (API 32)
Output of
react-native info
System:
OS: Windows 10 10.0.19042
CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
Memory: 18.33 GB / 31.94 GB
Binaries:
Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
Yarn: 3.1.1 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowAllTrustedApps: Disabled
IDEs:
Android Studio: Version 2021.1.0.0 AI-211.7628.21.2111.8193401
Visual Studio: 17.0.31912.275 (Visual Studio Community 2022)
Languages:
Java: 1.8.0_312
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.0 => 0.68.0
react-native-windows: Not Found
npmGlobalPackages:
react-native: Not Found
Issue and Reproduction Steps
Issue: Cannot find symbol
BuildConfig
Places issues detected:
File
android\app\src\main\java\com\rndiffapp\MainApplication.java
import com.rndiffapp.newarchitecture.components.MainComponentsRegistry;
return BuildConfig.DEBUG;
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED)
Steps tried to debug:
import com.rndiffapp.BuildConfig;
for this fileIssue: Cannot find symbol MainComponentsRegistry
File
android\app\src\main\java\com\rndiffapp\newarchitecture\MainApplicationReactNativeHost.java
return new MainApplicationTurboModuleManagerDelegate.Builder();
MainComponentsRegistry.register(componentFactory);
Steps tried to debug:
import com.rndiffapp.newarchitecture.components.MainComponentsRegistry;
to top of fileimport com.rndiffapp.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate;
to top of fileSteps to reproduce:
android/app/src/main/java/com/rndiffapp/MainApplication.java
yarn android
ornpm run react-native
The text was updated successfully, but these errors were encountered: