title: npm run android commad gives cannot find symbol errors
body: <p>While I was able to create my app with CRNA and eject it with npm run eject, and run it with npm run android, after three weeks this happened. For last 20 hours I deleted node,android studio,android sdk and downloaded all of them again. Still same errors occur. I quite do not understand if these are occur because of gradle or java or android. I have two questions.</p>
  
  <h3>Questions</h3>
  
  <p>1.How can I solve this problem?</p>
  
  <p>2.</p>
  
  <p>a) crna myApp -> cd myApp -> npm run eject -> npm run android | </p>
  
  <p>b) react-native init myApp -> cd myApp -> react-native run-android</p>
  
  <p>Second one works good, but I do not like expo. It seems ıt compiles and runs more slowly and creates a lot of errors with react-native link. I want to know in which circumstances I have to use one of them relatedly. I am about to kill myself so any help will be appreciated with best. </p>
  
  <pre><code>:app:compileDebugJavaWithJavac
  
  :app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
  
  \android\app\src\main\java\com\biktim\MainApplication.java:5: error: cannot find symbol
  import com.facebook.react.ReactApplication;
                       ^
  symbol:   class ReactApplication
  location: package com.facebook.react
  
  \android\app\src\main\java\com\biktim\MainApplication.java:6: error: cannot find symbol
  import com.facebook.react.ReactNativeHost;
                       ^
  symbol:   class ReactNativeHost
  location: package com.facebook.react
  
  \android\app\src\main\java\com\biktim\MainApplication.java:14: error: cannot find symbol
  public class MainApplication extends Application implements ReactApplication 
  {
                                                          ^
  symbol: class ReactApplication
  
  \android\app\src\main\java\com\biktim\MainApplication.java:16: error: cannot find symbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
              ^
  symbol:   class ReactNativeHost
  location: class MainApplication
  
  \android\app\src\main\java\com\biktim\MainApplication.java:36: error: cannot find symbol
  public ReactNativeHost getReactNativeHost() {
       ^
  symbol:   class ReactNativeHost
  location: class MainApplication
  
  \android\app\src\main\java\com\biktim\MainActivity.java:5: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity
  public class MainActivity extends ReactActivity {
     ^
  \android\app\src\main\java\com\biktim\MainApplication.java:16: error: cannot find symbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                                                     ^
  symbol:   class ReactNativeHost
  location: class MainApplication
  
  \android\app\src\main\java\com\biktim\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.
  </code></pre>
  
  <h3>MainApplication.java</h3>
  
  <pre><code> package com.biktim;
  
  import android.app.Application;
  
  import com.facebook.react.ReactApplication;
  import com.facebook.react.ReactNativeHost;
  import com.facebook.react.ReactPackage;
  import com.facebook.react.shell.MainReactPackage;
  import com.facebook.soloader.SoLoader;
  
  import java.util.Arrays;
  import java.util.List;
  
  public class MainApplication extends Application implements ReactApplication {
  
    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
      @Override
      public boolean getUseDeveloperSupport() {
        return BuildConfig.DEBUG;
      }
  
      @Override
      protected List&lt;ReactPackage&gt; getPackages() {
        return Arrays.&lt;ReactPackage&gt;asList(
            new MainReactPackage()
        );
      }
  
      @Override
      protected String getJSMainModuleName() {
        return "index";
      }
    };
  
    @Override
    public ReactNativeHost getReactNativeHost() {
      return mReactNativeHost;
    }
  
    @Override
    public void onCreate() {
      super.onCreate();
      SoLoader.init(this, /* native exopackage */ false);
    }
  }
  </code></pre>
  
  <h3>MainActivity.java</h3>
  
  <pre><code>package com.biktim;
  
  import com.facebook.react.ReactActivity;
  
  public class MainActivity extends ReactActivity {
  
  /**
   * Returns the name of the main component registered from JavaScript.
   * This is used to schedule rendering of the component.
   */
  @Override
  protected String getMainComponentName() {
      return "biktim";
  }
  </code></pre>
  
  <p>}</p>
  
  <h3>android/build.gradle</h3>
  
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  
  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"
          }
      }
  }
  </code></pre>
  
  <h3>android/app/build.gradle</h3>
  
  <pre><code>apply plugin: "com.android.application"
  
  import com.android.build.OutputFile
  
  
  
  project.ext.react = [
     entryFile: "index.js"
  ]
  
  apply from: "../../node_modules/react-native/react.gradle"
  
  /**
  * Set this to true to create two separate APKs instead of one:
  *   - An APK that only works on ARM devices
  *   - An APK that only works on x86 devices
  * The advantage is the size of the APK is reduced by about 4MB.
  * Upload all the APKs to the Play Store and people will download
  * the correct one based on the CPU architecture of their device.
  */
  def enableSeparateBuildPerCPUArchitecture = false
  
  /**
  * Run Proguard to shrink the Java bytecode in release builds.
  */
  def enableProguardInReleaseBuilds = false
  
  android {
  compileSdkVersion rootProject.ext.compileSdkVersion
  buildToolsVersion rootProject.ext.buildToolsVersion
  
  defaultConfig {
      applicationId "com.biktim2"
      minSdkVersion rootProject.ext.minSdkVersion
      targetSdkVersion rootProject.ext.targetSdkVersion
      versionCode 1
      versionName "1.0"
      ndk {
          abiFilters "armeabi-v7a", "x86"
      }
  }
  splits {
      abi {
          reset()
          enable enableSeparateBuildPerCPUArchitecture
          universalApk false  // If true, also generate a universal APK
          include "armeabi-v7a", "x86"
      }
  }
  buildTypes {
      release {
          minifyEnabled enableProguardInReleaseBuilds
          proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
      }
  }
  // applicationVariants are e.g. debug, release
  applicationVariants.all { variant -&gt;
      variant.outputs.each { output -&gt;
          // For each separate APK per architecture, set a unique version code as described here:
          // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
          def versionCodes = ["armeabi-v7a":1, "x86":2]
          def abi = output.getFilter(OutputFile.ABI)
          if (abi != null) {  // null for the universal-debug, universal-release variants
              output.versionCodeOverride =
                      versionCodes.get(abi) * 1048576 + 
  defaultConfig.versionCode
          }
      }
  }
  }
  
  dependencies {
  implementation fileTree(dir: "libs", include: ["*.jar"])
  implementation "com.android.support:appcompat- 
   v7:${rootProject.ext.supportLibVersion}"
  implementation "com.facebook.react:react-native:+"  // From node_modules
  }
  
  // Run this once to be able to run the application with BUCK
  // puts all compile dependencies into folder libs for BUCK to use
  task copyDownloadableDepsToLibs(type: Copy) {
  from configurations.compile
  into 'libs'
  }
  </code></pre>
  
  <h3>package.json</h3>
  
  <pre><code>{
    "name": "biktim2",
    "version": "0.0.1",
    "private": true,
    "scripts": {
      "start": "node node_modules/react-native/local-cli/cli.js start",
      "test": "jest"
    },
    "dependencies": {
      "react": "16.5.0",
      "react-native": "0.57.1"
    },
    "devDependencies": {
      "babel-jest": "23.6.0",
      "jest": "23.6.0",
      "metro-react-native-babel-preset": "0.45.6",
      "react-test-renderer": "16.5.0"
    },
    "jest": {
      "preset": "react-native"
    }
  }
  </code></pre>