Shusshu / Android-RecurrencePicker

Google Calendar Recurrence picker
Apache License 2.0
240 stars 51 forks source link

App crashing right away after including the library #15

Closed Shajeel-Afzal closed 8 years ago

Shajeel-Afzal commented 8 years ago

I am getting following exception after including in the project:

                                                                                 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shajeelafzal.quicktasks_app/com.shajeelafzal.quicktasks_app.MainActivity}: android.view.InflateException: Binary XML file line #28: Error inflating class android.support.design.widget.FloatingActionButton
                                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
                                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
                                                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135)
                                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                     at android.os.Looper.loop(Looper.java:136)
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5001)
                                                                                     at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                     at java.lang.reflect.Method.invoke(Method.java:515)
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
                                                                                     at dalvik.system.NativeStart.main(Native Method)
                                                                                  Caused by: android.view.InflateException: Binary XML file line #28: Error inflating class android.support.design.widget.FloatingActionButton
                                                                                     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.inflate(LayoutInflater.java:492)
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
                                                                                     at com.shajeelafzal.quicktasks_app.fragments.HomeFragment.onCreateView(HomeFragment.java:79)
                                                                                     at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962)
                                                                                     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
                                                                                     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248)
                                                                                     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
                                                                                     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1613)
                                                                                     at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:330)
                                                                                     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:547)
                                                                                     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
                                                                                     at android.app.Activity.performStart(Activity.java:5241)
                                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157)
                                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
                                                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                     at android.os.Looper.loop(Looper.java:136) 
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5001) 
                                                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
                                                                                     at dalvik.system.NativeStart.main(Native Method) 
                                                                                  Caused by: java.lang.reflect.InvocationTargetException
                                                                                     at java.lang.reflect.Constructor.constructNative(Native Method)
                                                                                     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
                                                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:594)
                                                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
                                                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                                                                                     at com.shajeelafzal.quicktasks_app.fragments.HomeFragment.onCreateView(HomeFragment.java:79) 
                                                                                     at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962) 
                                                                                     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
                                                                                     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248) 
                                                                                     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738) 
                                                                                     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1613) 
                                                                                     at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:330) 
                                                                                     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:547) 
                                                                                     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171) 
                                                                                     at android.app.Activity.performStart(Activity.java:5241) 
                                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157) 
                                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
                                                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                     at android.os.Looper.loop(Looper.java:136) 
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5001) 
                                                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
                                                                                     at dalvik.system.NativeStart.main(Native Method) 
                                                                                  Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x2
                                                                                     at android.content.res.TypedArray.getColor(TypedArray.java:327)
                                                                                     at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:120)
                                                                                     at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:104)
                                                                                     at java.lang.reflect.Constructor.constructNative(Native Method) 
                                                                                     at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
                                                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
                                                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
                                                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                                                                                     at com.shajeelafzal.quicktasks_app.fragments.HomeFragment.onCreateView(HomeFragment.java:79) 
                                                                                     at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962) 
                                                                                     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067) 
                                                                                     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1248) 
                                                                                     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738) 
                                                                                     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1613) 
                                                                                     at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:330) 
                                                                                     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:547) 
                                                                                     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171) 
                                                                                     at android.app.Activity.performStart(Activity.java:5241) 
                                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2157) 
                                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 
                                                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                     at android.os.Looper.loop(Looper.java:136) 
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5001) 
                                                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 
                                                                                     at dalvik.system.NativeStart.main(Native Method) 

My build.gradle file looks like this:

android {
    compileSdkVersion 23
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.shajeelafzal.quicktasks_app"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        buildToolsVersion '23'
        compileSdkVersion 23
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
}
Shusshu commented 8 years ago

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shajeelafzal.quicktasks_app/com.shajeelafzal.quicktasks_app.MainActivity}: android.view.InflateException: Binary XML file line #28: Error inflating class android.support.design.widget.FloatingActionButton

Paste your XML

Shajeel-Afzal commented 8 years ago

Please note that the app works fine without library.

Layout file:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/tools"
    android:id="@+id/main_parent_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/home_background"
    android:gravity="center_vertical|center_horizontal"
    android:orientation="vertical">

    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@null"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

</FrameLayout>
Shusshu commented 8 years ago

I can't see the FloatingActionButton in your XML there (which was part of the error msg)

Shusshu commented 8 years ago

I was thinking of a conflict between libs but it seems unlikely

Shajeel-Afzal commented 8 years ago

Its in the fragment, here is the layout:

<android.support.design.widget.CoordinatorLayout 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:id="@+id/rootLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="56dp"
    tools:context="com.shajeelafzal.quicktasks_app.fragments.HomeFragment">

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipe_refresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/tasks_recyclerview"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </android.support.v4.widget.SwipeRefreshLayout>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/home_fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end|bottom"
        android:src="@drawable/ic_action_icon_plus"
        app:borderWidth="0dp"
        app:fabSize="normal"
        app:layout_anchor="@id/rootLayout"
        app:layout_anchorGravity="bottom|right|end" />
</android.support.design.widget.CoordinatorLayout>
Shusshu commented 8 years ago

can you paste your gradle file with deps

Shajeel-Afzal commented 8 years ago

Sure:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile('com.mikepenz:materialdrawer:3.1.1@aar') {
        transitive = true
    }
    compile files('libs/gson-2.2.4.jar')
    compile files('libs/gson-2.2.4-javadoc.jar')
    compile files('libs/gson-2.2.4-sources.jar')
    compile files('libs/httpcore-4.0.1.jar')
    compile files('libs/httpmime-4.2.6.jar')
    compile files('libs/joda-time-2.2.jar')
    compile('com.crashlytics.sdk.android:crashlytics:2.5.0@aar') {
        transitive = true;
    }
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services-wallet:8.4.0'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.google.android.gms:play-services-appinvite:8.4.0'
    compile 'com.google.android.gms:play-services-analytics:8.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.google.android.gms:play-services-auth:8.4.0'
    compile 'com.android.support:design:23.1.1'
    compile 'de.hdodenhof:circleimageview:1.3.0'
    compile 'com.github.bumptech.glide:glide:3.6.0'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'jp.wasabeef:recyclerview-animators:1.2.1'
    compile 'com.prolificinteractive:material-calendarview:0.7.0'
    compile 'com.github.alamkanak:android-week-view:1.2.3'
    compile 'com.firebase:firebase-client-android:2.5.0'
    compile 'com.firebaseui:firebase-ui:0.3.0'
    compile 'be.billington.calendar.recurrencepicker:library:1.1.1'
}
Shusshu commented 8 years ago

logcat says: Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x2

Do you have some code that is setting the color on the FAB ?

com.shajeelafzal.quicktasks_app.fragments.HomeFragment.onCreateView(HomeFragment.java:79)

Shusshu commented 8 years ago

that line 79 is probably your XML

so there might be a conflict between colours between the 2 libs

Shajeel-Afzal commented 8 years ago

No. Although the app automatically picks the Primary color from the resources since the project is using material theme.

Shajeel-Afzal commented 8 years ago

Yup may be. But what will be solution?

Shusshu commented 8 years ago

find which colours first... depends how many... I could fix it on my side ...

Shajeel-Afzal commented 8 years ago

Ok. Also please update it according to new material theme, currently it is using Holo theme i guess. https://github.com/Shusshu/Android-RecurrencePicker/issues/1

Shajeel-Afzal commented 8 years ago

My colors.xml looks like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <color name="primary">#4CAF50</color>
    <color name="primary_dark">#388E3C</color>
    <color name="primary_light">#C8E6C9</color>
    <color name="accent">#FB3E70</color>
    <color name="primary_text">#FFFFFF</color>
    <color name="secondary_text">#FFFFFF</color>
    <color name="icons">#FFFFFF</color>
    <color name="divider">#B6B6B6</color>
    <color name="flat_pressed">#66999999</color>
    <color name="flat_disabled_text">#40000000</color>
    <color name="flat_normal_text">#000000</color>

    <color name="material_drawer_primary_text">#49484E</color>
    <color name="background_color">#E6E6E6</color>
    <color name="label_color">#878787</color>
    <color name="text_color">#27272E</color>

</resources>
Shusshu commented 8 years ago

I made a test project (new project from android studio) added my lib and it works fine, it runs fine (it also has the design lib)

Shusshu commented 8 years ago

so I guess there's no conflicts

Shusshu commented 8 years ago
Ok. Also please update it according to new material theme, currently it is using Holo theme i guess. #1

Pull requests are welcome

Shajeel-Afzal commented 8 years ago

Thanks.

Shusshu commented 8 years ago

I'd like to help you more but I'm facing a dead end here....

Shajeel-Afzal commented 8 years ago

I can understand :+1:

Shusshu commented 8 years ago

I tried with the following config on my newly created project:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "be.billington.android.myapplicationtest"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'be.billington.calendar.recurrencepicker:library:1.1.1'
    compile 'de.hdodenhof:circleimageview:1.3.0'
    compile 'com.github.bumptech.glide:glide:3.6.0'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'jp.wasabeef:recyclerview-animators:1.2.1'
    compile 'com.prolificinteractive:material-calendarview:0.7.0'
    compile 'com.github.alamkanak:android-week-view:1.2.3'
    compile 'com.firebase:firebase-client-android:2.5.0'
    compile 'com.firebaseui:firebase-ui:0.3.0'
    compile('com.mikepenz:materialdrawer:3.1.1@aar') {
        transitive = true
    }
    compile 'com.google.android.gms:play-services-wallet:8.4.0'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.google.android.gms:play-services-appinvite:8.4.0'
    compile 'com.google.android.gms:play-services-analytics:8.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.google.android.gms:play-services-auth:8.4.0'
    compile 'com.android.support:recyclerview-v7:23.1.1'
}
Shusshu commented 8 years ago

Works fine... closing

Shusshu commented 8 years ago

I would look into the deps that are in your libs folder