Closed Shajeel-Afzal closed 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
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>
I can't see the FloatingActionButton in your XML there (which was part of the error msg)
I was thinking of a conflict between libs but it seems unlikely
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>
can you paste your gradle file with deps
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'
}
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)
that line 79 is probably your XML
so there might be a conflict between colours between the 2 libs
No. Although the app automatically picks the Primary color from the resources since the project is using material theme.
Yup may be. But what will be solution?
find which colours first... depends how many... I could fix it on my side ...
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
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>
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)
so I guess there's no conflicts
Ok. Also please update it according to new material theme, currently it is using Holo theme i guess. #1
Pull requests are welcome
Thanks.
I'd like to help you more but I'm facing a dead end here....
I can understand :+1:
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'
}
Works fine... closing
I would look into the deps that are in your libs folder
I am getting following exception after including in the project:
My
build.gradle
file looks like this: