unsplash / unsplash-photopicker-android

📱An Android photo picker to search and download photos from Unsplash.
MIT License
336 stars 62 forks source link

Crash while initializing library #10

Open vikram731 opened 3 years ago

vikram731 commented 3 years ago

I am initializing the library like this (in JAVA) -

UnsplashPhotoPicker.INSTANCE.init( getApplication(), // application "xxxxxxxx", "xxxxxxxx", 20 );

It works most of the time but I have seen crashes in many devices with below stacktrace. Am I initializing the library in some wrong way or is it a bug?

Fatal Exception: java.lang.RuntimeException Unable to start activity ComponentInfo{com.vikrams.quotescreator/com.unsplash.pickerandroid.photopicker.presentation.UnsplashPickerActivity}: kotlin.UninitializedPropertyAccessException: lateinit property application has not been initialized

Stacktrace:

com.unsplash.pickerandroid.photopicker.UnsplashPhotoPicker.getApplication (UnsplashPhotoPicker.java:36) com.unsplash.pickerandroid.photopicker.Injector.createHttpClient (Injector.java:46) com.unsplash.pickerandroid.photopicker.Injector.createRetrofitBuilder (Injector.java:56) com.unsplash.pickerandroid.photopicker.Injector.createNetworkEndpoints (Injector.java:61) com.unsplash.pickerandroid.photopicker.Injector.createRepository (Injector.java:64) com.unsplash.pickerandroid.photopicker.Injector.createPickerViewModelFactory (Injector.java:68) com.unsplash.pickerandroid.photopicker.presentation.UnsplashPickerActivity.onCreate (UnsplashPickerActivity.java:66) android.app.Activity.performCreate (Activity.java:7964) android.app.Activity.performCreate (Activity.java:7953) android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1307) android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3472) android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3636)