gowong / material-sheet-fab

Android library that provides the floating action button to sheet transition from Google's Material Design.
MIT License
1.58k stars 255 forks source link

Apk crashing below 5.0 #3

Closed jiteshlalwani closed 9 years ago

jiteshlalwani commented 9 years ago

App is crashing below 5.0 and when I include CircularReveal (as per the instructions), I am not able to build the apk only. I have raised issue with CircularReveal library also. Request you to please help me out in case if there is some workaround.

link - https://github.com/ozodrukh/CircularReveal/issues/43

gowong commented 9 years ago

What is the error when your app crashes? Can you include your build.gradle as well?

jiteshlalwani commented 9 years ago
FATAL EXCEPTION: main
    android.view.InflateException: Binary XML file line #115: Error inflating class android.support.v7.widget.CardView
            at android.view.LayoutInflater.createView(LayoutInflater.java:620)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
            at com.blackcoffee.onfriday.me.ui.MovieDetailsFragment.onCreateView(MovieDetailsFragment.java:89)
            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1789)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:955)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
            at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
            at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
            at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:490)
            at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
            at android.support.v4.view.ViewPager.populate(ViewPager.java:1105)
            at android.support.v4.view.ViewPager.populate(ViewPager.java:951)
            at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1473)
            at android.view.View.measure(View.java:15848)
            at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:728)
            at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:477)
            at android.view.View.measure(View.java:15848)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5012)
            at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
            at android.support.v7.internal.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:124)
            at android.view.View.measure(View.java:15848)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5012)
            at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
            at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
            at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
            at android.view.View.measure(View.java:15848)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5012)
            at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
            at android.view.View.measure(View.java:15848)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5012)
            at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
            at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
            at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
            at android.view.View.measure(View.java:15848)
            at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5012)
            at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
            at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2189)
            at android.view.View.measure(View.java:15848)
            at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1905)
            at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1104)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1284)
            at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004)
            at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
            at android.view.Choreographer.doCallbacks(Choreographer.java:562)
            at android.view.Choreographer.doFrame(Choreographer.java:532)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5103)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.in
jiteshlalwani commented 9 years ago

Gradle:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
//    compile files('libs/FlurryAnalytics-5.5.0.jar')
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    // Dagger 2 dependencies
    apt 'com.google.dagger:dagger-compiler:2.0'
    provided 'org.glassfish:javax.annotation:10.0-b28'
    apt 'com.google.dagger:dagger-compiler:2.0'
    provided 'org.glassfish:javax.annotation:10.0-b28'
    provided 'org.projectlombok:lombok:1.12.6'
    apt "org.projectlombok:lombok:1.12.6"
    compile 'com.github.nicolasjafelle:paginglistview:1.2'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.android.support:support-v4:22.2.1'
//    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:recyclerview-v7:22.2.0'
    compile 'com.jakewharton:butterknife:6.1.0'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.google.dagger:dagger:2.0'
    compile 'com.squareup.okhttp:okhttp:2.0.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'io.reactivex:rxjava:1.0.10'
    compile 'io.reactivex:rxandroid:0.24.0'
    compile 'com.github.oxo42:stateless4j:2.5.0'
    compile('com.android.support:cardview-v7:22.2.0')
            {
                exclude module: 'CircularReveal'
            }
    compile 'javax.inject:javax.inject:1'
//    compile 'com.lsjwzh:materialloadingprogressbar:0.5.5-RELEASE'
    compile('com.android.support:design:22.2.0')
            {
                exclude module: 'CircularReveal'
            }
    compile 'com.android.support:palette-v7:22.2.0'
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.google.apis:google-api-services-youtube:v3-rev142-1.20.0'
    compile('com.gordonwong:material-sheet-fab:1.0.1') {
        exclude module: 'CircularReveal'
    }
    compile('com.wrapp.floatlabelededittext:library:0.0.6')
            {
                exclude module: 'CircularReveal'
            }
    compile 'uk.co.chrisjenx:calligraphy:2.1.0'
    compile('com.pkmmte.view:circularimageview:1.1')
            {
                exclude module: 'CircularReveal'
            }
    compile 'com.facebook.android:facebook-android-sdk:4.1.0'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'com.android.support:multidex:1.0.0'
//    compile 'com.github.ozodrukh:CircularReveal:1.1.0'
    compile 'me.villani.lorenzo.android:android-cropimage:1.1.0'
    compile 'com.kbeanie:image-chooser-library:1.4.4@aar'
    compile "commons-io:commons-io:2.4"
jiteshlalwani commented 9 years ago

Please note below code was written as suggested on - ozodrukh/CircularReveal#43

exclude module: 'CircularReveal'

Even without above code, the app crashes

prabel commented 9 years ago

Please check puli request #2. I albo have issues on pre 21. It was crash with invalid setBackground on CardView.

gowong commented 9 years ago

@codeismine The error you posted indicates that there is a problem inflating the CardView. You can try googling "Error inflating class android.support.v7.widget.CardView" and following the suggested solutions, but I don't think the issue has to do with the material sheet fab library.

jiteshlalwani commented 9 years ago

Hi,

Thanks for the reply. I can confirm that it is due to material sheet fab only as when I remove the library than it works fine on all devices but not when I include material sheet fab library. Also I am using cardview in two places which they are working fine. Thanks On Aug 17, 2015 5:50 AM, "Gordon Wong" notifications@github.com wrote:

@codeismine https://github.com/codeismine The error you posted indicates that there is a problem inflating the CardView. You can try googling "Error inflating class android.support.v7.widget.CardView" and following the suggested solutions, but I don't think the issue has to do with the material sheet fab library.

— Reply to this email directly or view it on GitHub https://github.com/gowong/material-sheet-fab/issues/3#issuecomment-131644331 .

gowong commented 9 years ago

The library doesn't have CardView as a dependency so I'm not sure what's going on here... You don't need to include CircularReveal as a dependency (the instructions actually don't tell you to do this) so try removing it as well as all of the exclude module: 'CircularReveal' blocks. Can you also post the layout XML file that's mentioned in the crash?

jiteshlalwani commented 9 years ago

I have done as instructed but still getting crash. PFA XML

  <!-- Circular reveal container for the sheet -->
    <io.codetail.widget.RevealLinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="end|bottom"
        android:orientation="vertical">

        <!-- Sheet that contains your items -->
        <android.support.v7.widget.CardView
            android:id="@+id/fab_sheet"
            style="@style/Widget.MaterialSheetFab.Sheet">

            <!-- Sheet items -->
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <!-- Recording -->
                <TextView
                    android:id="@+id/fabReminderTextView"

style="@style/TextAppearance.MaterialSheetFab.Sheet.Item"
                    android:drawableLeft="@drawable/ic_reviews_icon"
                    android:drawableStart="@drawable/ic_reviews_icon"
                    android:text="@string/reminder"
                    android:visibility="gone" />

                <!-- Reminder -->
                <TextView
                    android:id="@+id/fabLogoutTextView"

style="@style/TextAppearance.MaterialSheetFab.Sheet.Item"
                    android:drawableLeft="@drawable/ic_reviews_icon"
                    android:drawableStart="@drawable/ic_reviews_icon"
                    android:text="@string/logout"
                    android:visibility="gone" />

                <!-- Photo -->
                <TextView
                    android:id="@+id/fabProfileTextView"

style="@style/TextAppearance.MaterialSheetFab.Sheet.Item"
                    android:drawableLeft="@drawable/ic_reviews_icon"
                    android:drawableStart="@drawable/ic_reviews_icon"
                    android:text="@string/profile"
                    android:visibility="gone" />

                <!-- Note -->
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/theme_accent">

                    <TextView
                        android:id="@+id/fabCreateReviewTextView"

style="@style/TextAppearance.MaterialSheetFab.Sheet.Item"
                        android:drawableLeft="@drawable/ic_reviews_icon"
                        android:drawableStart="@drawable/ic_reviews_icon"
                        android:text="@string/write_review" />
                </LinearLayout>

            </LinearLayout>

        </android.support.v7.widget.CardView>
 </io.codetail.widget.RevealLinearLayout>
jiteshlalwani commented 9 years ago

Please note if I remove this particular line than app is not crashing but

offcourse the circle is moving around unexpectedly

style="@style/Widget.MaterialSheetFab.Sheet"

On Mon, Aug 17, 2015 at 1:57 PM, Jitesh Lalwani jitesh.h.lalwani@gmail.com wrote:

I have done as instructed but still getting crash. PFA XML

<io.codetail.widget.RevealLinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="end|bottom"
    android:orientation="vertical">
    <!-- Sheet that contains your items -->
    <android.support.v7.widget.CardView
        android:id="@+id/fab_sheet"
        style="@style/Widget.MaterialSheetFab.Sheet">

        <!-- Sheet items -->
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <!-- Recording -->
            <TextView
                android:id="@+id/fabReminderTextView"

style="@style/TextAppearance.MaterialSheetFab.Sheet.Item" android:drawableLeft="@drawable/ic_reviews_icon" android:drawableStart="@drawable/ic_reviews_icon" android:text="@string/reminder" android:visibility="gone" />

            <!-- Reminder -->
            <TextView
                android:id="@+id/fabLogoutTextView"

style="@style/TextAppearance.MaterialSheetFab.Sheet.Item" android:drawableLeft="@drawable/ic_reviews_icon" android:drawableStart="@drawable/ic_reviews_icon" android:text="@string/logout" android:visibility="gone" />

            <!-- Photo -->
            <TextView
                android:id="@+id/fabProfileTextView"

style="@style/TextAppearance.MaterialSheetFab.Sheet.Item" android:drawableLeft="@drawable/ic_reviews_icon" android:drawableStart="@drawable/ic_reviews_icon" android:text="@string/profile" android:visibility="gone" />

            <!-- Note -->
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/theme_accent">

                <TextView
                    android:id="@+id/fabCreateReviewTextView"

style="@style/TextAppearance.MaterialSheetFab.Sheet.Item" android:drawableLeft="@drawable/ic_reviews_icon" android:drawableStart="@drawable/ic_reviews_icon" android:text="@string/write_review" />

        </LinearLayout>

    </android.support.v7.widget.CardView>

</io.codetail.widget.RevealLinearLayout>

On Mon, Aug 17, 2015 at 9:40 AM, Gordon Wong notifications@github.com wrote:

The library doesn't have CardView as a dependency so I'm not sure what's going on here... You don't need to include CircularReveal as a dependency (the instructions actually don't tell you to do this) so try removing it as well as all of the exclude module: 'CircularReveal' blocks. Can you also post the layout XML file that's mentioned in the crash?

— Reply to this email directly or view it on GitHub https://github.com/gowong/material-sheet-fab/issues/3#issuecomment-131674698 .

jiteshlalwani commented 9 years ago

Hi,

I was able to run the code now by copying literally everything from your sample as it is. But I face two problems now:

1) Floating button after closing is moving towards top

2) I get an error for elavation in styles.xml under values folder that min required is 21.

PFA Screenshot

On Mon, Aug 17, 2015 at 2:04 PM, Jitesh Lalwani jitesh.h.lalwani@gmail.com wrote:

Please note if I remove this particular line than app is not crashing but

offcourse the circle is moving around unexpectedly

style="@style/Widget.MaterialSheetFab.Sheet"

On Mon, Aug 17, 2015 at 1:57 PM, Jitesh Lalwani < jitesh.h.lalwani@gmail.com> wrote:

I have done as instructed but still getting crash. PFA XML

<io.codetail.widget.RevealLinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="end|bottom"
    android:orientation="vertical">
    <!-- Sheet that contains your items -->
    <android.support.v7.widget.CardView
        android:id="@+id/fab_sheet"
        style="@style/Widget.MaterialSheetFab.Sheet">

        <!-- Sheet items -->
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <!-- Recording -->
            <TextView
                android:id="@+id/fabReminderTextView"

style="@style/TextAppearance.MaterialSheetFab.Sheet.Item" android:drawableLeft="@drawable/ic_reviews_icon" android:drawableStart="@drawable/ic_reviews_icon" android:text="@string/reminder" android:visibility="gone" />

            <!-- Reminder -->
            <TextView
                android:id="@+id/fabLogoutTextView"

style="@style/TextAppearance.MaterialSheetFab.Sheet.Item" android:drawableLeft="@drawable/ic_reviews_icon" android:drawableStart="@drawable/ic_reviews_icon" android:text="@string/logout" android:visibility="gone" />

            <!-- Photo -->
            <TextView
                android:id="@+id/fabProfileTextView"

style="@style/TextAppearance.MaterialSheetFab.Sheet.Item" android:drawableLeft="@drawable/ic_reviews_icon" android:drawableStart="@drawable/ic_reviews_icon" android:text="@string/profile" android:visibility="gone" />

            <!-- Note -->
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/theme_accent">

                <TextView
                    android:id="@+id/fabCreateReviewTextView"

style="@style/TextAppearance.MaterialSheetFab.Sheet.Item" android:drawableLeft="@drawable/ic_reviews_icon" android:drawableStart="@drawable/ic_reviews_icon" android:text="@string/write_review" />

        </LinearLayout>

    </android.support.v7.widget.CardView>

</io.codetail.widget.RevealLinearLayout>

On Mon, Aug 17, 2015 at 9:40 AM, Gordon Wong notifications@github.com wrote:

The library doesn't have CardView as a dependency so I'm not sure what's going on here... You don't need to include CircularReveal as a dependency (the instructions actually don't tell you to do this) so try removing it as well as all of the exclude module: 'CircularReveal' blocks. Can you also post the layout XML file that's mentioned in the crash?

— Reply to this email directly or view it on GitHub https://github.com/gowong/material-sheet-fab/issues/3#issuecomment-131674698 .

gowong commented 9 years ago

Have you defined the style Widget.MaterialSheetFab.Sheet?

1) It's hard to tell what's going on without seeing all of the code. Can you create a gist of the layout file and the java code where you are initializing the materialSheetFab and showing it?

2) The IDE warnings about elevation are fine. You can ignore those or if you like, move the elevation styles to v21 only styles.

gowong commented 9 years ago

No response, assuming that the problem is solved. Feel free to reopen.

jiteshlalwani commented 9 years ago

reopening with gist - https://gist.github.com/codeismine/6e0ad2c690c37d5057e1

Button is not going back to its original position after closing it

gowong commented 9 years ago

Are you using the latest version of the library? This should have been fixed by #5

jiteshlalwani commented 9 years ago

Yes working fine now, thanks a ton!

On Sat, Sep 5, 2015 at 1:45 PM, Gordon Wong notifications@github.com wrote:

Are you using the latest version of the library? This should have been fixed by #5 https://github.com/gowong/material-sheet-fab/issues/5

— Reply to this email directly or view it on GitHub https://github.com/gowong/material-sheet-fab/issues/3#issuecomment-137928482 .