Closed tamasszadvari closed 3 years ago
Will check and confirm, are you able to build the sample app and run it?
@tamasszadvari I guess you are explicitly invoking AWSDKDelegate.OnCreate(this);
which is not required.
Please checkWorkspaceOneApplication.cs
where you need to extend your Application
Class with WorkspaceOneApplication
and override the OnCreate()
, this will take care on KoinModule Loading.
Hello @akalghatgi Yes, I'm invoking that method, because it's in the readme file. :)
@Maddy79 I haven't tried. But I've done everything according to the instructions, so if it's true that I shouldn't invoke the AWSDKDelegate.OnCreate(this)
method, then it should be removed from the documentation.
@tamasszadvari , please remove AWSDKDelegate.OnCreate from your code, we will update the document. Thanks for bringing this up.
@Maddy79 Without that, my application now crashes instantly. It doesn't even show the splash screen. See stack trace:
01-21 18:10:37.762: E/AndroidRuntime(29827): FATAL EXCEPTION: main
01-21 18:10:37.762: E/AndroidRuntime(29827): Process: hu.mvm.communicatoralpha, PID: 29827
01-21 18:10:37.762: E/AndroidRuntime(29827): java.lang.RuntimeException: Unable to start activity ComponentInfo{hu.mvm.communicatoralpha/com.airwatch.gateway.ui.GatewaySplashActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
01-21 18:10:37.762: E/AndroidRuntime(29827): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2957)
01-21 18:10:37.762: E/AndroidRuntime(29827): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
01-21 18:10:37.762: E/AndroidRuntime(29827): at android.app.ActivityThread.-wrap11(Unknown Source:0)
01-21 18:10:37.762: E/AndroidRuntime(29827): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
01-21 18:10:37.762: E/AndroidRuntime(29827): at android.os.Handler.dispatchMessage(Handler.java:105)
01-21 18:10:37.762: E/AndroidRuntime(29827): at android.os.Looper.loop(Looper.java:164)
01-21 18:10:37.762: E/AndroidRuntime(29827): at android.app.ActivityThread.main(ActivityThread.java:6944)
01-21 18:10:37.762: E/AndroidRuntime(29827): at java.lang.reflect.Method.invoke(Native Method)
01-21 18:10:37.762: E/AndroidRuntime(29827): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
01-21 18:10:37.762: E/AndroidRuntime(29827): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
01-21 18:10:37.762: E/AndroidRuntime(29827): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
01-21 18:10:37.762: E/AndroidRuntime(29827): at com.airwatch.sdk.context.awsdkcontext.SDKDataModelImpl.
@tamasszadvari can you confirm if you have added base.OnCreate(this);
public override void OnCreate()
{
base.OnCreate(this);
}
please refer WorkspaceOneApplication.cs
@akalghatgi Thanks, that helped! :)
thanks @tamasszadvari to confirm this.
Using the latest version of the WorkspaceOne.Forms package (2.1.0) the app crashes instantly, when I start the application. It produces the following stacktrace:
01-15 14:41:51.641: E/AndroidRuntime(23125): FATAL EXCEPTION: main 01-15 14:41:51.641: E/AndroidRuntime(23125): Process: hu.mvm.communicatoralpha, PID: 23125 01-15 14:41:51.641: E/AndroidRuntime(23125): java.lang.RuntimeException: Unable to create application crc64e0480d581e1d7f15.Application: java.lang.IllegalStateException: No Koin Context configured. Please use startKoin or koinApplication DSL. 01-15 14:41:51.641: E/AndroidRuntime(23125): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6065) 01-15 14:41:51.641: E/AndroidRuntime(23125): at android.app.ActivityThread.-wrap1(Unknown Source:0) 01-15 14:41:51.641: E/AndroidRuntime(23125): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764) 01-15 14:41:51.641: E/AndroidRuntime(23125): at android.os.Handler.dispatchMessage(Handler.java:105) 01-15 14:41:51.641: E/AndroidRuntime(23125): at android.os.Looper.loop(Looper.java:164) 01-15 14:41:51.641: E/AndroidRuntime(23125): at android.app.ActivityThread.main(ActivityThread.java:6944) 01-15 14:41:51.641: E/AndroidRuntime(23125): at java.lang.reflect.Method.invoke(Native Method) 01-15 14:41:51.641: E/AndroidRuntime(23125): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) 01-15 14:41:51.641: E/AndroidRuntime(23125): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) 01-15 14:41:51.641: E/AndroidRuntime(23125): Caused by: java.lang.IllegalStateException: No Koin Context configured. Please use startKoin or koinApplication DSL. 01-15 14:41:51.641: E/AndroidRuntime(23125): at org.koin.core.context.KoinContextHandler.getContext(SourceFile:29) 01-15 14:41:51.641: E/AndroidRuntime(23125): at org.koin.core.context.KoinContextHandler.get(SourceFile:35) 01-15 14:41:51.641: E/AndroidRuntime(23125): at org.koin.java.KoinJavaComponent.getKoin(SourceFile:97) 01-15 14:41:51.641: E/AndroidRuntime(23125): at org.koin.java.KoinJavaComponent.get(SourceFile:63) 01-15 14:41:51.641: E/AndroidRuntime(23125): at org.koin.java.KoinJavaComponent.get$default(SourceFile:60) 01-15 14:41:51.641: E/AndroidRuntime(23125): at com.airwatch.app.AWSDKApplicationDelegate.onCreate(Unknown Source:62) 01-15 14:41:51.641: E/AndroidRuntime(23125): at crc64e0480d581e1d7f15.Application.n_onCreate(Native Method) 01-15 14:41:51.641: E/AndroidRuntime(23125): at crc64e0480d581e1d7f15.Application.onCreate(SourceFile:25) 01-15 14:41:51.641: E/AndroidRuntime(23125): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1125) 01-15 14:41:51.641: E/AndroidRuntime(23125): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6062) 01-15 14:41:51.641: E/AndroidRuntime(23125): ... 8 more
If I call the
KoinModule.Instance.Load(this);
method in the Application class's OnCreate method, before theAWSDKDelegate.OnCreate(this);
line, the app starts correctly.The problem was present with the previous WorkspaceOne.Forms version too.
Please correct the setup instructions, or tell me what have I done wrong. Thanks!