Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] lateinit property imageAdapter crash when using fish bun in fragment #253

Closed
Moony-H opened this issue Aug 25, 2022 · 5 comments
Closed
Assignees
Labels

Comments

@Moony-H
Copy link

Moony-H commented Aug 25, 2022

version 1.0.0-beta01
im getting crashes when fishbun started in fragment.


here's log


kotlin.UninitializedPropertyAccessException: lateinit property imageAdapter has not been initialized
        at com.sangcomz.fishbun.Fishton.getImageAdapter(Fishton.kt:15)
        at com.sangcomz.fishbun.datasource.FishBunDataSourceImpl.getImageAdapter(FishBunDataSourceImpl.kt:27)
        at com.sangcomz.fishbun.ui.album.model.repository.AlbumRepositoryImpl.getImageAdapter(AlbumRepositoryImpl.kt:40)
        at com.sangcomz.fishbun.ui.album.mvp.AlbumPresenter$loadAlbumList$1$1$onSuccess$1.invoke(AlbumPresenter.kt:33)
        at com.sangcomz.fishbun.ui.album.mvp.AlbumPresenter$loadAlbumList$1$1$onSuccess$1.invoke(AlbumPresenter.kt:28)
        at com.sangcomz.fishbun.util.MainUiHandler.run$lambda-0(MainUiHandler.kt:11)
        at com.sangcomz.fishbun.util.MainUiHandler.$r8$lambda$ESEsIHm4quKOiXRP0dkG-n5rAMY(Unknown Source:0)
        at com.sangcomz.fishbun.util.MainUiHandler$$ExternalSyntheticLambda0.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:205)
        at android.app.ActivityThread.main(ActivityThread.java:6991)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:884)

and my code


FishBun.with(this).setImageAdapter(GlideAdapter())
    .startAlbumWithActivityResultCallback(getResultFromFishBun)

but, set the "setIsUseDetailView" false, it works.


//it works
FishBun.with(this).setImageAdapter(GlideAdapter())
                .setIsUseDetailView(false)
                .startAlbumWithActivityResultCallback(getResultFromFishBun)

i dont know why. how can i do?

@Moony-H Moony-H added the bug label Aug 25, 2022
@Moony-H Moony-H changed the title [BUG] [BUG] lateinit property imageAdapter crash when using fish bun in fragment Aug 25, 2022
@sangcomz sangcomz self-assigned this Sep 26, 2022
@sangcomz
Copy link
Owner

Hi, Moony-H.
I can't reproduce this issue. 😢
could you give me the code?

@mxalbert1996
Copy link

This bug is consistently reproducible when using AndroidX Fragment 1.5.0 and above.
You can reproduce it by simply adding implementation "androidx.fragment:fragment:1.5.5" to FishBunDemo/build.gradle.

@sangcomz
Copy link
Owner

please use 1.1.1 version. thanks

@BorlandDev
Copy link

This bug is consistently reproducible when using AndroidX Fragment 1.5.0 and above. You can reproduce it by simply adding implementation "androidx.fragment:fragment:1.5.5" to FishBunDemo/build.gradle.

Hi. I have this bug, but i have not this dependends .

My dependensies:

implementation("androidx.core:core-ktx:1.7.0")
implementation("androidx.appcompat:appcompat:1.4.1")
implementation("com.google.android.material:material:1.6.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")

implementation('androidx.navigation:navigation-fragment-ktx:2.4.2')
implementation('androidx.navigation:navigation-ui-ktx:2.4.2')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.activity:activity-ktx:1.6.1'

@sangcomz
Copy link
Owner

Thanks for sharing :)
I'm considering solving it through this PR(#262).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants