f111fei/react-native-unity-view

Android app crashes on startup.

Apetrou opened this issue · 4 comments

Hi,
I'm having issues with my app crashing as soon as it starts up. I get the following error trace on logcat:

06-24 21:46:15.111 6650 6650 E AndroidRuntime: FATAL EXCEPTION: main
06-24 21:46:15.111 6650 6650 E AndroidRuntime: Process: com.xxxx, PID: 6650
06-24 21:46:15.111 6650 6650 E AndroidRuntime: java.lang.Error: Unresolved compilation problems:
06-24 21:46:15.111 6650 6650 E AndroidRuntime: The import android.app cannot be resolved
06-24 21:46:15.111 6650 6650 E AndroidRuntime: The import com.facebook.react.ReactApplication cannot be resolved
06-24 21:46:15.111 6650 6650 E AndroidRuntime: The import com.swmansion.gesturehandler.react.RNGestureHandlerPackage cannot be resolved
06-24 21:46:15.111 6650 6650 E AndroidRuntime: The import com.facebook.react.ReactNativeHost cannot be resolved
06-24 21:46:15.111 6650 6650 E AndroidRuntime: The import com.facebook.react.ReactPackage cannot be resolved
06-24 21:46:15.111 6650 6650 E AndroidRuntime: The import com.facebook.react.shell cannot be resolved
06-24 21:46:15.111 6650 6650 E AndroidRuntime: The import com.facebook.soloader.SoLoader cannot be resolved
06-24 21:46:15.111 6650 6650 E AndroidRuntime: Application cannot be resolved to a type
06-24 21:46:15.111 6650 6650 E AndroidRuntime: ReactApplication cannot be resolved to a type
06-24 21:46:15.111 6650 6650 E AndroidRuntime: ReactNativeHost cannot be resolved to a type
06-24 21:46:15.111 6650 6650 E AndroidRuntime: ReactNativeHost cannot be resolved to a type
06-24 21:46:15.111 6650 6650 E AndroidRuntime: The method getUseDeveloperSupport() of type new ReactNativeHost(){} must override or implement a supertype method
06-24 21:46:15.111 6650 6650 E AndroidRuntime: ReactPackage cannot be resolved to a type
06-24 21:46:15.111 6650 6650 E AndroidRuntime: The method getPackages() of type new ReactNativeHost(){} must override or implement a supertype method
06-24 21:46:15.111 6650 6650 E AndroidRuntime: ReactPackage cannot be resolved to a type
06-24 21:46:15.111 6650 6650 E AndroidRuntime: MainReactPackage cannot be resolved to a type
06-24 21:46:15.111 6650 6650 E AndroidRuntime: RNGestureHandlerPackage cannot be resolved to a type
06-24 21:46:15.111 6650 6650 E AndroidRuntime: The method getJSMainModuleName() of type new ReactNativeHost(){} must override or implement a supertype method
06-24 21:46:15.111 6650 6650 E AndroidRuntime: ReactNativeHost cannot be resolved to a type
06-24 21:46:15.111 6650 6650 E AndroidRuntime: The method getReactNativeHost() of type MainApplication must override or implement a supertype method
06-24 21:46:15.111 6650 6650 E AndroidRuntime: ReactNativeHost cannot be resolved to a type
06-24 21:46:15.111 6650 6650 E AndroidRuntime: The method onCreate() of type MainApplication must override or implement a supertype method
06-24 21:46:15.111 6650 6650 E AndroidRuntime: Application cannot be resolved to a type
06-24 21:46:15.111 6650 6650 E AndroidRuntime: SoLoader cannot be resolved
06-24 21:46:15.111 6650 6650 E AndroidRuntime:
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at com.xxxx.MainApplication.(MainApplication.java:3)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at java.lang.Class.newInstance(Native Method)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:50)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at android.app.Instrumentation.newApplication(Instrumentation.java:1120)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at android.app.LoadedApk.makeApplication(LoadedApk.java:1061)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5842)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at android.app.ActivityThread.access$1100(ActivityThread.java:199)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at android.os.Looper.loop(Looper.java:193)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6669)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
06-24 21:46:15.111 6650 6650 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

I know its this package causing it as when I comment out its references the error stops. I assume what is happening is that the unity view is crashing for some reason and because the unity activity runs in parallel with the main activity it also causes that to crash producing the error of modules not being resolved. Is anyone else having or has had a similar issue and if so how did you deal with it?

Many thanks,
Alkis.

@Apetrou What was your solution?

It was due to an issue with my unity file. When I fixed the issues in the unity file and re exported it worked fine!

It was due to an issue with my unity file. When I fixed the issues in the unity file and re exported it worked fine!

Hey @Apetrou , thanks for reaching out! Can you please describe a bit more in detail what the issue exactly was? Code side? Plugin side? Or something different?

The solution for our issue is this: #142 (comment)