Home » Android » (Unknown Source:7) error in kotlin android

(Unknown Source:7) error in kotlin android

Posted by: admin November 1, 2017 Leave a comment

Questions:

I just converted my java project to kotlin in android and after that I’m facing following issue. This isn’t indicating whether the error is?

    Process: com.app.furr, PID: 12420 
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.furr/com.app.furr.DashboardActivity}: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter savedInstanceState
                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
                                                                      at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
                                                                      at android.os.Handler.dispatchMessage(Handler.java:105)
                                                                      at android.os.Looper.loop(Looper.java:164)
                                                                      at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                                                                   Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter savedInstanceState
                                                                      at com.app.furr.mall.list.MallListFragment.onCreateView(Unknown Source:7)
                                                                      at android.app.Fragment.performCreateView(Fragment.java:2611)
                                                                      at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1276)
                                                                      at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2415)
                                                                      at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2194)
                                                                      at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2148)
                                                                      at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2049)
                                                                      at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3044)
                                                                      at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2991)
                                                                      at android.app.FragmentController.dispatchActivityCreated(FragmentController.java:178)
                                                                      at android.app.Activity.performCreateCommon(Activity.java:6969)
                                                                      at android.app.Activity.performCreate(Activity.java:6977)
                                                                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
                                                                      at android.app.ActivityThread.p

erformLaunchActivity(ActivityThread.java:2770
Answers:

In MallListFragment, you need to define onCreateView like this

fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?) : View? {
    ... 
}