Closed JB-CHAUVIN closed 1 year ago
It is like .tk files are ignored ? I don't know...
Did you try cd android && ./gradlew clean
? and run again
And it is better to upgrade versions one by one
Yes I tried @raajnadar ! still not working
ok thanks for the tips.. will do this next time
Any ideas ? Still got the problem after many cleaning :
> Task :ReactAndroid:compileReleaseJavaWithJavac FAILED
/Users/jbchauvin/Documents/Cegedim/Code/Mobile/1933/packages/mobile/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java:18: error: package com.facebook.react.common.mapbuffer does not exist
import com.facebook.react.common.mapbuffer.MapBuffer;
^
/Users/jbchauvin/Documents/Cegedim/Code/Mobile/1933/packages/mobile/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/StateWrapper.java:12: error: package com.facebook.react.common.mapbuffer does not exist
import com.facebook.react.common.mapbuffer.ReadableMapBuffer;
^
/Users/jbchauvin/Documents/Cegedim/Code/Mobile/1933/packages/mobile/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java:356: error: cannot find symbol
MapBuffer localData,
After investigation : the app is building fine on Android WITHOUT new architecture enabled. So that's the problem...
the app is building fine on Android WITHOUT new architecture enabled.
Yup that's a bug. Are you able to provide a reproducer of any sort?
:warning: | Missing Reproducible Example |
---|---|
:information_source: | It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner. |
the app is building fine on Android WITHOUT new architecture enabled.
Yup that's a bug. Are you able to provide a reproducer of any sort?
The problem is that my project is big I and I can't take the risk of sharing the code :/
The problem is that my project is big I and I can't take the risk of sharing the code :/
I'm not asking for your project but for a reproducer: https://stackoverflow.com/help/minimal-reproducible-example
Same 66 errors here!
cannot find symbol if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { symbol: variable IS_NEW_ARCHITECTURE_ENABLED location: class BuildConfig
located /home/expo/workingdir/build/android/app/src/main/java/com/lordisasi/nduleafrik/MainApplication.java:62:
/home/expo/workingdir/build/android/app/src/main/java/com/lordisasi/nduleafrik/MainActivity.java:34: error: cannot find symbol return reactRootView; ^ symbol: variable reactRootView location: class MainActivity /home/expo/workingdir/build/android/app/src/main/java/com/lordisasi/nduleafrik/MainActivity.java:36: error: method does not override or implement a method from a supertype @Override ^ MainApplication.java
package com.lordisasi.nduleafrik;
import android.content.res.Configuration; import expo.modules.ApplicationLifecycleDispatcher; import expo.modules.ReactNativeHostWrapper;
import android.app.Application; import android.content.Context; import android.content.res.Configuration; import androidx.annotation.NonNull;
import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.reactnativecommunity.picker.RNCPickerPackage; import com.reactnativecommunity.picker.RNCPickerPackage; import com.reactnativecommunity.picker.RNCPickerPackage; import com.facebook.react.ReactInstanceManager; import com.facebook.react.BuildConfig; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.config.ReactFeatureFlags; import com.facebook.soloader.SoLoader; import com.lordisasi.nduleafrik.newarchitecture.MainApplicationReactNativeHost;
import android.content.res.Configuration; import expo.modules.ApplicationLifecycleDispatcher; import expo.modules.ReactNativeHostWrapper;
import java.lang.reflect.InvocationTargetException; import java.util.List;
public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper( this, new ReactNativeHostWrapper(this, new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; }
@Override protected List<ReactPackage> getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List<ReactPackage> packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: return packages; } @Override protected String getJSMainModuleName() { return "index"; }
}));
private final ReactNativeHost mNewArchitectureNativeHost = new ReactNativeHostWrapper(this, new MainApplicationReactNativeHost(this));
@Override public ReactNativeHost getReactNativeHost() { if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { return mNewArchitectureNativeHost; } else { return mReactNativeHost; } }
@Override public void onCreate() { super.onCreate(); // If you opted-in for the New Architecture, we enable the TurboModule system ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; SoLoader.init(this, / native exopackage / false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); ApplicationLifecycleDispatcher.onApplicationCreate(this);
}
@Override public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig); }
/**
- Loads Flipper in React Native templates. Call this in the onCreate method with something like
- initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
- @param context
- @param reactInstanceManager / private static void initializeFlipper( Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { / We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ Class<?> aClass = Class.forName("com.lordisasi.nduleafrik.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }
MainActivity.java
package com.lordisasi.nduleafrik;
import android.os.Build; import android.os.Bundle;
import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; import com.facebook.react.ReactRootView;
import expo.modules.ReactActivityDelegateWrapper;
public class MainActivity extends ReactActivity { @Override protected void onCreate(Bundle savedInstanceState) { // Set the theme to AppTheme BEFORE onCreate to support // coloring the background, status bar, and navigation bar. // This is required for expo-splash-screen. setTheme(R.style.AppTheme); super.onCreate(null); }
/**
- Returns the name of the main component registered from JavaScript.
This is used to schedule rendering of the component. */ @Override protected String getMainComponentName() { return "main"; }
/**
- Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
- you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
(Paper). */ @Override protected ReactActivityDelegate createReactActivityDelegate() {
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED); return reactRootView; } @Override protected boolean isConcurrentRootEnabled() { // If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18). // More on this on https://reactjs.org/blog/2022/03/29/react-v18.html return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; }/**
- Align the back button behavior with Android S
- where moving root activities to background instead of finishing activities.
@see onBackPressed */ @Override public void invokeDefaultOnBackPressed() { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) { if (!moveTaskToBack(false)) { // For non-root activities, use the default implementation to finish them. super.invokeDefaultOnBackPressed(); } return; }
// Use the default back button implementation on Android S // because it's doing more than {@link Activity#moveTaskToBack} in fact. super.invokeDefaultOnBackPressed(); } }
@OverRide
You're having a typo. It's @Override
https://github.com/facebook/react-native/blob/49c90f7a7ee1290bc694184873bdc0e06318ba98/template/android/app/src/main/java/com/helloworld/MainActivity.java#L13
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Closing as I provided an answer already
I have the following error with RN 0.69 when I enable new architecture.
Build Target(s)
Android emulator
Output of
react-native info
System: OS: macOS 12.2.1 CPU: (10) x64 Apple M1 Pro Memory: 25.27 MB / 32.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.19.1 - /usr/local/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 6.14.16 - /usr/local/bin/npm Watchman: 2022.06.13.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: API Levels: 26, 30, 31, 32 Build Tools: 29.0.2, 29.0.3, 31.0.0, 32.0.0, 32.1.0 System Images: android-26 | Google APIs ARM 64 v8a, android-30 | Google APIs ARM 64 v8a, android-32 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8309675 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.15 - /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.3 => 0.69.3 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Issue and Reproduction Steps
Hello,
When I run the run-android command I have the following error :