ZeeRooo / MaterialFBook

A light alternative client for Facebook based on the web with a modern look (Material Design)
GNU General Public License v3.0
139 stars 44 forks source link

[BUG] Crash when clicking "Hamburger Menu" #206

Closed surfrock66 closed 4 years ago

surfrock66 commented 5 years ago

Nexus6P Running Android 8.1.0. December 5 2018 Patch level.

Open MaterialFBook, click the hamburger menu from any screen; app instantly closes. A "email compose" screen pops up with debug information, but the "to" field is a bogus address and cannot be sent. If a debug email address is preferred, I can send the crash info upon request.

ZeeRooo commented 5 years ago

Please send the email to: chavesjuan400@gmail.com

I have deleted the email because someone have uploaded the app to playstore with other name and i'm receiving errors all the day.

theopensourceguy commented 5 years ago

It's going to crash on all devices running API 26 or higher, as soon as you open the navigation drawer. Luckily, I think I found the root of the problem.

In res/layout/nav_header_main.xml, the ImageView for the profile picture is initialized with the app icon. But because it is initialized as a background property using android:background="..." instead of app:srcCompat="...", some newly introduced component in API 26 freaks out and throws an IllegalArgumentException. Still don't exactly understand why that is, but my attached patch fixes the problem on every device running 8.1 I could get my hands on.

Index: app/src/main/res/layout/nav_header_main.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/src/main/res/layout/nav_header_main.xml (revision d8c1b6dec15ab0417934151441ca57dd331050f3)
+++ app/src/main/res/layout/nav_header_main.xml (date 1547058222876)
@@ -1,4 +1,5 @@
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="@dimen/nav_header_height"
     android:gravity="bottom">
@@ -20,7 +21,7 @@
             android:layout_width="75dp"
             android:layout_height="75dp"
             android:layout_gravity="start"
-            android:background="@mipmap/ic_launcher_round" />
+            app:srcCompat="@mipmap/ic_launcher_round" />

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