andremion / Louvre

A small customizable library useful to handle an gallery image pick action built-in your app. :sunrise_over_mountains::stars:

Home Page:https://play.google.com/store/apps/details?id=com.andremion.louvre.sample

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get Crash When Click on Single Image

jays95jp opened this issue · comments

hi @andremion , Thanks for create that wonderful photo picker library, Really appreciate.

I get one crash when I click on single image for preview. Here is crash log:

java.lang.RuntimeException: Unable to start activity ComponentInfo{promanager.com.promanagerandroid/com.andremion.louvre.preview.PreviewActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2756)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2825)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1557)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6339)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference
at com.andremion.louvre.preview.PreviewActivity.onCreate(PreviewActivity.java:129)
at android.app.Activity.performCreate(Activity.java:6689)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1140)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2709)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2825) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1557) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:203) 
at android.app.ActivityThread.main(ActivityThread.java:6339) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945) 

Here my configuration detail:


    androidBuildToolsVersion = "27.0.2"
    androidMinSdkVersion = 19
    androidTargetSdkVersion = 27
    androidCompileSdkVersion = 27

    SUPPORT_LIB_VERSION = "27.0.2"

get null in PreviewActivity screen line number 127
( getSupportActionBar().setDisplayHomeAsUpEnabled(true);)

Please give update on this, Don't have any idea why this exception occur. In demo it's work perfect.
Thanks :)

Hi @jays95jp , thank you for using it.

Please make sure you are setting the Activities themes as mentioned in README.file

Let me know if this works.

Hello @andremion , Yes I am using same style and theme which is mention in README. file
If you want any information from my side than i will provide you.
Thanks @andremion for take interest in this issue. :)

Could you please, show me your AndroidManifest.xml file and your themes/styles file ?

   <activity
            android:name="com.andremion.louvre.home.GalleryActivity"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme.Louvre.Light.DarkActionBar">
            <meta-data
                android:name="parentActivityName"
                android:value=".MainActivity" />
        </activity>
        <activity
            android:name="com.andremion.louvre.preview.PreviewActivity"
            android:theme="@style/AppTheme.Louvre.Preview" />

    <style name="AppTheme.Louvre.Light.DarkActionBar" parent="Louvre.Theme.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="AppTheme.Louvre.Dark" parent="Louvre.Theme.Dark">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="AppTheme.Louvre.Light" parent="Louvre.Theme.Light">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="AppTheme.Louvre.Preview" parent="Louvre.Theme.Preview">
        <item name="colorAccent">@color/colorAccent</item>
    </style>

@andremion Here is my style and AndroidManifest file

I still don't knowing what happens... Which Louvre version are you using?

It's working perfect in demo , but i try to integrate in my project than it give crash.
I am using V-1.2.0.

Try to use the latest version 1.2.3

Getting same error after update version. Here I am attach a screen shot. I don't have idea whether it's related to app theme or code!
screenshot at jan 30 13-05-26

Did you get this on emulators and devices? 100% or in some cases?

Yes, I am getting this issue in both(Emulator and devices). And every time this crash is happen (100%)

I'm sorry.
I really can't help you if I can't reproducing this 😐