codelab-mlkit-android icon indicating copy to clipboard operation
codelab-mlkit-android copied to clipboard

lateinit property outputFileUri has not been initialized

Open SagarKhurana opened this issue 5 years ago • 1 comments

Hi, I am referring the tutorial of codelabs to work with ML Kit and at step 5 when I run the application I get the below error. I tried to run the final module as well, faced the same issue.

Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=null} to activity {com.google.firebase.mlkit.codelab.objectdetection/com.google.firebase.mlkit.codelab.objectdetection.MainActivity}: kotlin.UninitializedPropertyAccessException: lateinit property outputFileUri has not been initialized
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4179)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3476)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3542) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2790) 
        at android.app.ActivityThread.-wrap12(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1523) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:163) 
        at android.app.ActivityThread.main(ActivityThread.java:6238) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:933) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823) 
     Caused by: kotlin.UninitializedPropertyAccessException: lateinit property outputFileUri has not been initialized
        at com.google.firebase.mlkit.codelab.objectdetection.MainActivity.getCapturedImage(MainActivity.kt:136)
        at com.google.firebase.mlkit.codelab.objectdetection.MainActivity.onActivityResult(MainActivity.kt:84)

When I debug the app, I can see the var is initialized and the value is stored, but when at onactivityresult this exception is thrown. any quick solution for the same would be great.

SagarKhurana avatar May 15 '19 07:05 SagarKhurana

I have the same issue.

AchrafAmil avatar May 19 '19 20:05 AchrafAmil