skydoves / PowerSpinner

🌀 A lightweight dropdown popup spinner, fully customizable with an arrow and animations for Android.
Apache License 2.0
1.22k stars 116 forks source link

App Crash on when using the spinner Android 6 and below at library 1.1.8 #75

Closed ismaelshehada closed 3 years ago

ismaelshehada commented 3 years ago

Describe the Bug:

Hello, There's a bug that is being reported by crashlytics on Android 5 and 6 and I faced when testing on Android 4.4 that causes the app to crash when using the spinner. it's working fine on Android 10 and Android 8 this the logcat

ismaelshehada commented 3 years ago

at library Version 1.1.4, not crash?

skydoves commented 3 years ago

Hi, @ismaelshehada Thanks for your reporting. Are there any details of the crashes?

ismaelshehada commented 3 years ago

E/AndroidRuntime: FATAL EXCEPTION: main Process: rawafed.edu.ps, PID: 1827 java.lang.RuntimeException: Unable to start activity ComponentInfo{rawafed.edu.ps/rawafed.edu.ps.Screens.AddExperimentsActivity}: android.view.InflateException: Binary XML file line #92: Binary XML file line #92: Error inflating class com.skydoves.powerspinner.PowerSpinnerView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) at android.app.ActivityThread.access$1100(ActivityThread.java:223) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7223) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by: android.view.InflateException: Binary XML file line #92: Binary XML file line #92: Error inflating class com.skydoves.powerspinner.PowerSpinnerView

ismaelshehada commented 3 years ago

@skydoves

skydoves commented 3 years ago

Could you share your xml file that includes PowerSpinnerView?

ismaelshehada commented 3 years ago

<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Screens.AddExperimentsActivity">

<androidx.appcompat.widget.Toolbar
    android:id="@+id/toolbarExAdd"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/purple_700"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageView
            android:id="@+id/BackArrowAddExp"
            android:layout_width="@dimen/_25sdp"
            android:layout_height="@dimen/_25sdp"
            android:layout_gravity="start"
            android:scaleType="fitCenter"
            android:src="@drawable/ic_baseline_arrow_back_ios_24"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="@dimen/_16sdp"
            android:gravity="center"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <TextView
                android:id="@+id/AddTitleV"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:fontFamily="@font/sf_pro_display_bold"
                android:text="اضافة مكتبة"
                android:textColor="@color/white"
                android:textSize="@dimen/_14sdp" />
        </LinearLayout>

    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.appcompat.widget.Toolbar>

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/toolbarExAdd">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/_10sdp">

        <com.skydoves.powerspinner.PowerSpinnerView
            android:id="@+id/spinnerGrade"
            android:layout_width="@dimen/_130sdp"
            android:layout_height="@dimen/_30sdp"
            android:layout_marginStart="@dimen/_16sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:background="@drawable/select_shape"
            android:foreground="?attr/selectableItemBackground"
            android:gravity="center"
            android:hint="اختر الصف"
            android:fontFamily="@font/sf_pro_display_bold"
            android:padding="10dp"
            android:textColor="@color/white"
            android:textColorHint="@color/white"
            android:textSize="14.5sp"
            app:spinner_arrow_gravity="end"
            app:spinner_arrow_tint="@color/white"
            app:spinner_divider_color="@color/white"
            app:spinner_divider_show="true"
            app:spinner_divider_size="0.4dp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:spinner_item_array="@array/spinnerGrade" />

        <com.skydoves.powerspinner.PowerSpinnerView
            android:id="@+id/spinnerSubject"
            android:layout_width="@dimen/_130sdp"
            android:layout_height="@dimen/_30sdp"
            android:layout_marginEnd="@dimen/_16sdp"
            android:background="@drawable/select_shape"
            android:foreground="?attr/selectableItemBackground"
            android:gravity="center"
            android:padding="10dp"
            android:hint="اختر المادة"
            android:fontFamily="@font/sf_pro_display_bold"
            android:textColor="@color/white"
            android:textColorHint="@color/white"
            android:textSize="14.5sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@+id/spinnerGrade"
            app:spinner_arrow_gravity="end"
            app:spinner_arrow_tint="@color/white"
            app:spinner_divider_color="@color/white"
            app:spinner_divider_show="true"
            app:spinner_divider_size="0.4dp" />

        <com.skydoves.powerspinner.PowerSpinnerView
            android:id="@+id/spinnerDepartment"
            android:layout_width="@dimen/_130sdp"
            android:layout_height="@dimen/_30sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:background="@drawable/select_shape"
            android:foreground="?attr/selectableItemBackground"
            android:gravity="center"
            android:hint="اختر القسم"
            android:fontFamily="@font/sf_pro_display_bold"
            android:padding="10dp"
            android:textColor="@color/white"
            android:textColorHint="@color/white"
            android:textSize="14.5sp"
            app:spinner_arrow_gravity="end"
            app:spinner_arrow_tint="@color/white"
            app:spinner_divider_color="@color/white"
            app:spinner_divider_show="true"
            app:spinner_divider_size="0.4dp"
            app:spinner_item_array="@array/spinnerDepart"
            app:layout_constraintStart_toStartOf="@+id/spinnerGrade"
            app:layout_constraintTop_toBottomOf="@+id/spinnerGrade"/>

        <com.skydoves.powerspinner.PowerSpinnerView
            android:id="@+id/spinnerLesson"
            android:layout_width="@dimen/_130sdp"
            android:layout_height="@dimen/_30sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:background="@drawable/select_shape"
            android:foreground="?attr/selectableItemBackground"
            android:gravity="center"
            android:hint="اختر الدرس"
            android:fontFamily="@font/sf_pro_display_bold"
            android:textColor="@color/white"
            android:textColorHint="@color/white"
            android:textSize="14.5sp"
            android:padding="10dp"
            app:layout_constraintEnd_toEndOf="@+id/spinnerSubject"
            app:layout_constraintTop_toBottomOf="@+id/spinnerSubject"
            app:spinner_arrow_gravity="end"
            app:spinner_arrow_tint="@color/white"
            app:spinner_divider_color="@color/white"
            app:spinner_divider_show="true"
            app:spinner_divider_size="0.4dp" />

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/EdTitleLayout"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/_16sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:layout_marginEnd="@dimen/_16sdp"
            android:gravity="center_vertical"
            android:hint="العنوان"
            app:boxStrokeColor="@color/purple_200"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/spinnerDepartment">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/EdTitle"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/EdDescriptionLayout"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
            android:layout_width="0dp"
            android:layout_height="@dimen/_100sdp"
            android:layout_marginTop="@dimen/_10sdp"

            android:hint="الوصف"
            app:boxStrokeColor="@color/purple_200"
            app:layout_constraintEnd_toEndOf="@+id/EdTitleLayout"
            app:layout_constraintStart_toStartOf="@+id/EdTitleLayout"
            app:layout_constraintTop_toBottomOf="@+id/EdTitleLayout">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/EdDescription"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="top"
                android:inputType="textMultiLine" />
        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/EdToolsLayout"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/_10sdp"
            android:gravity="center_vertical"
            android:hint="الادوات"
            app:boxStrokeColor="@color/purple_200"
            app:layout_constraintEnd_toEndOf="@id/EdDescriptionLayout"
            app:layout_constraintStart_toStartOf="@id/EdDescriptionLayout"
            app:layout_constraintTop_toBottomOf="@+id/EdDescriptionLayout">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/EdTools"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/EdViewLayout"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/_10sdp"
            android:gravity="center_vertical"
            android:hint="المشاهدة"
            app:boxStrokeColor="@color/purple_200"
            app:layout_constraintEnd_toEndOf="@id/EdToolsLayout"
            app:layout_constraintStart_toStartOf="@id/EdToolsLayout"
            app:layout_constraintTop_toBottomOf="@+id/EdToolsLayout">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/EdView"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/EdResultLayout"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/_10sdp"
            android:gravity="center_vertical"
            android:hint="النتائج"
            app:boxStrokeColor="@color/purple_200"
            app:layout_constraintEnd_toEndOf="@id/EdViewLayout"
            app:layout_constraintStart_toStartOf="@id/EdViewLayout"
            app:layout_constraintTop_toBottomOf="@+id/EdViewLayout">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/EdResult"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/EdAddImageLayout"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/_10sdp"
            android:gravity="start|center_vertical"
            android:hint="اضف صور/URL"
            app:boxStrokeColor="@color/purple_200"
            app:startIconDrawable="@drawable/ic_photo_add"
            app:layout_constraintEnd_toEndOf="@+id/EdResultLayout"
            app:layout_constraintStart_toStartOf="@+id/EdResultLayout"
            app:layout_constraintTop_toBottomOf="@+id/EdResultLayout"
            >

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/EdAddImage"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/EdAddVideoLayout"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/_10sdp"
            android:hint="اضف فيديو/URL"
            app:boxStrokeColor="@color/purple_200"
            app:layout_constraintEnd_toEndOf="@id/EdAddImageLayout"
            app:layout_constraintStart_toStartOf="@+id/EdAddImageLayout"
            app:layout_constraintTop_toBottomOf="@+id/EdAddImageLayout"
            app:startIconDrawable="@drawable/ic_video_file">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/EdAddVideo"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        </com.google.android.material.textfield.TextInputLayout>

        <Button
            android:id="@+id/BtnFirstOnBoarding"
            android:layout_width="match_parent"
            android:layout_height="@dimen/_40sdp"
            android:layout_marginStart="@dimen/_16sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:layout_marginEnd="@dimen/_16sdp"
            android:background="@drawable/shape_button"
            android:fontFamily="@font/sf_pro_display_bold"
            android:text="اضافة"
            android:textSize="@dimen/_16sdp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/EdAddVideoLayout" />
    </androidx.constraintlayout.widget.ConstraintLayout>

</ScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>

skydoves commented 3 years ago

You can resolve using this: #9 I will update this issue in the next release. Thanks!

AndrewParkhomov commented 3 years ago

version 1.1.8 same issue with nubia NX551J 6.0.1 meizu m5c 6.0

version 1.1.7 work well

raghavendra-uno commented 3 years ago

Hi @skydoves ,

The library is great but as reported. It is crashing for Android 6. Well 1.1.7 is working fine but the latest one that is 1.1.8 is causing the crash. Please can you look into it.

skydoves commented 3 years ago

hi @raghavendra-uno Could you report your crash?

skydoves commented 3 years ago

Please try to use 1.1.9-SNAPSHOT.

raghavendra-uno commented 3 years ago

Hi,

Thanks for the quick response. Well tried adding

com.github.skydoves:powerspinner:1.1.9-SNAPSHOT

Could not find com.github.skydoves:powerspinner:1.1.9-SNAPSHOT.

skydoves commented 3 years ago

Did you add the below download repository on your gradle file?

repositories {
   maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
raghavendra-uno commented 3 years ago

Hi @skydoves ,

Thanks for the quick response once again. Well Its working fine, thanks a lot. Can I go push this to production until the next version gets rolled out???

skydoves commented 3 years ago

A new stable 1.1.9 has been released. Thanks for reporting the issue!