Question Detail

I have created React Native project by npm install -g create-react-native-app to import project 

it imports many packages and at the end shows Expo QR code I don't want to run React native app in Expo I need to execute it as the Native app so I exit from npm run eject and it ask to me for How would you like to eject from create-react-native-app? React Native: I'd like a regular React Native project. after all this, I have successfully exited from running npm Now I have the project with android and ios folder too.

To Run Hello World React Native 

npm run android

These are the version of my Needed Libs which is using in the React Native App Development

Node -v
v8.11.2

npm -v
6.4.1

react-native -v
react-native-cli: 2.0.1
react-native: 0.55.4

 

ERROR: 

warning: string 'catalyst_debugjs' has no default translation.
warning: string 'catalyst_element_inspector' has no default translation.
warning: string 'catalyst_jsload_error' has no default translation.
warning: string 'catalyst_jsload_message' has no default translation.
warning: string 'catalyst_jsload_title' has no default translation.
warning: string 'catalyst_reloadjs' has no default translation.
warning: string 'catalyst_settings' has no default translation.
warning: string 'catalyst_settings_title' has no default translation.

:app:generateDebugSources
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:\ReactNative\PROJECTFOLDER\android\app\src\main\java\com\appName\MainApplication.java:5: error: cannot find symbol
import com.facebook.react.ReactApplication;
                         ^
  symbol:   class ReactApplication
  location: package com.facebook.react
C:\ReactNative\PROJECTFOLDER\android\app\src\main\java\com\appName\MainApplication.java:6: error: cannot find symbol
import com.facebook.react.ReactNativeHost;
                         ^
  symbol:   class ReactNativeHost
  location: package com.facebook.react
C:\ReactNative\PROJECTFOLDER\android\app\src\main\java\com\appName\MainApplication.java:14: error: cannot find symbol
public class MainApplication extends Application implements ReactApplication {
                                                            ^
  symbol: class ReactApplication
C:\ReactNative\PROJECTFOLDER\android\app\src\main\java\com\appName\MainApplication.java:16: error: cannot find symbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                ^
  symbol:   class ReactNativeHost
  location: class MainApplication
C:\ReactNative\PROJECTFOLDER\android\app\src\main\java\com\appName\MainApplication.java:36: error: cannot find symbol
  public ReactNativeHost getReactNativeHost() {
         ^
  symbol:   class ReactNativeHost
  location: class MainApplication
C:\ReactNative\PROJECTFOLDER\android\app\src\main\java\com\appName\MainActivity.java:5: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity
public class MainActivity extends ReactActivity {
       ^
C:\ReactNative\PROJECTFOLDER\android\app\src\main\java\com\appName\MainApplication.java:16: error: cannot find symbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                                                       ^
  symbol:   class ReactNativeHost
  location: class MainApplication
C:\ReactNative\PROJECTFOLDER\android\app\src\main\java\com\appName\MainApplication.java:35: error: method does not override or implement a method from a supertype
  @Override
  ^
8 errors
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build 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.

BUILD FAILED

Total time: 1 mins 3.452 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html


Thread Reply

Hemant Sharma

- 1 months ago

I was also facing this issue by updating Android SDK Latest is Android Oreo so React Native also update ourself Marshmellow to Oreo. 

For new Projects, you have to update your SDK with Android Oreo API 26

 

Select the "SDK Platforms" tab from within the SDK Manager, then check the box next to "Show Package Details" in the bottom right corner. Look for and expand the Android 8.0 (Oreo) entry, then make sure the following items are all checked:

  • Android SDK Platform 26
  • Google APIs Intel x86 Atom_64 System Image

Android SDK Manager

Next, select the "SDK Tools" tab and check the box next to "Show Package Details" here as well. Look for and expand the "Android SDK Build-Tools" entry, then make sure that 26.0.3 is selected.

Android SDK Manager - 26.0.3 Build Tools

Finally, click "Apply" to download and install the Android SDK and related build tools.

Android SDK Manager - Installs

 

After follow these steps you can create your project in React Native

Hemant Sharma

- 1 months ago

I was also facing this issue by updating Android SDK Latest is Android Oreo so React Native also update ourself Marshmellow to Oreo. 

For new Projects, you have to update your SDK with Android Oreo API 26

 

Select the "SDK Platforms" tab from within the SDK Manager, then check the box next to "Show Package Details" in the bottom right corner. Look for and expand the Android 8.0 (Oreo) entry, then make sure the following items are all checked:

  • Android SDK Platform 26
  • Google APIs Intel x86 Atom_64 System Image

Android SDK Manager

Next, select the "SDK Tools" tab and check the box next to "Show Package Details" here as well. Look for and expand the "Android SDK Build-Tools" entry, then make sure that 26.0.3 is selected.

Android SDK Manager - 26.0.3 Build Tools

Finally, click "Apply" to download and install the Android SDK and related build tools.

Android SDK Manager - Installs

 

After follow these steps you can create your project in React Native