javareact-nativebuildgoogle-playmain-activity

How can I solve this problem in building apk using react native?


I published an app on the app store, I tried to install it, but it crashed. So I discovered that I didn't have the bundle in the project, I added it and now I have 11 errors when I try to build the new apk. That's are the errors:

Task :app:compileReleaseJavaWithJavac FAILED
/home/marco/Progetti/Brawl/android/app/src/main/java/com/brawl/MainApplication.java:5: error: cannot find symbol
import com.facebook.react.ReactApplication;
                         ^
  symbol:   class ReactApplication
  location: package com.facebook.react
/home/marco/Progetti/Brawl/android/app/src/main/java/com/brawl/MainApplication.java:6: error: cannot find symbol
import com.facebook.react.ReactNativeHost;
                         ^
  symbol:   class ReactNativeHost
  location: package com.facebook.react
/home/marco/Progetti/Brawl/android/app/src/main/java/com/brawl/MainApplication.java:14: error: cannot find symbol
public class MainApplication extends Application implements ReactApplication {
                                                            ^
  symbol: class ReactApplication
/home/marco/Progetti/Brawl/android/app/src/main/java/com/brawl/MainApplication.java:16: error: cannot find symbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                ^
  symbol:   class ReactNativeHost
  location: class MainApplication
/home/marco/Progetti/Brawl/android/app/src/main/java/com/brawl/MainApplication.java:36: error: cannot find symbol
  public ReactNativeHost getReactNativeHost() {
         ^
  symbol:   class ReactNativeHost
  location: class MainApplication
/home/marco/Progetti/Brawl/android/app/src/main/java/com/brawl/MainApplication.java:16: error: cannot find symbol
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
                                                       ^
  symbol:   class ReactNativeHost
  location: class MainApplication
/home/marco/Progetti/Brawl/android/app/src/main/java/com/brawl/MainApplication.java:17: error: method does not override or implement a method from a supertype
    @Override
    ^
/home/marco/Progetti/Brawl/android/app/src/main/java/com/brawl/MainApplication.java:22: error: method does not override or implement a method from a supertype
    @Override
    ^
/home/marco/Progetti/Brawl/android/app/src/main/java/com/brawl/MainApplication.java:29: error: method does not override or implement a method from a supertype
    @Override
    ^
/home/marco/Progetti/Brawl/android/app/src/main/java/com/brawl/MainApplication.java:35: error: method does not override or implement a method from a supertype
  @Override
  ^
/home/marco/Progetti/Brawl/android/app/src/main/java/com/brawl/MainActivity.java:5: error: MainActivity is not abstract and does not override abstract method getPackages() in ReactActivity
public class MainActivity extends ReactActivity {
       ^
11 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.

Solution

  • It seems that you either don't have the Android SDK installed or some dependencies. By what you said, it seems it was the first case.