Skip to content

BUG: In Login activity, app crashes during orientation change. #1207

@knight-shade

Description

@knight-shade

Summary:

When orientation change occurs in login activity, it crashes the app.

Steps to reproduce:

How can we reproduce the issue?

  1. Go the login screen (Logout if already logged in).
  2. Change the phone orientation.

Add System logs:

02-26 07:40:20.076 19163-19163/fr.free.nrw.commons.debug E/AndroidRuntime: FATAL EXCEPTION: main
                                                                           Process: fr.free.nrw.commons.debug, PID: 19163
                                                                           java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.free.nrw.commons.debug/fr.free.nrw.commons.auth.LoginActivity}: java.lang.IllegalStateException: Required view 'login_credentials' with ID 2131689634 for field 'loginCredentials' was not found. If this view is optional add '@Nullable' (fields) or '@Optional' (methods) annotation.
                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2696)
                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2757)
                                                                               at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4553)
                                                                               at android.app.ActivityThread.-wrap19(ActivityThread.java)
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1512)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                               at android.os.Looper.loop(Looper.java:163)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:6237)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                                                                            Caused by: java.lang.IllegalStateException: Required view 'login_credentials' with ID 2131689634 for field 'loginCredentials' was not found. If this view is optional add '@Nullable' (fields) or '@Optional' (methods) annotation.
                                                                               at butterknife.internal.Utils.findRequiredView(Utils.java:92)
                                                                               at butterknife.internal.Utils.findRequiredViewAsType(Utils.java:104)
                                                                               at fr.free.nrw.commons.auth.LoginActivity_ViewBinding.<init>(LoginActivity_ViewBinding.java:37)
                                                                               at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                               at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
                                                                               at butterknife.ButterKnife.createBinding(ButterKnife.java:199)
                                                                               at butterknife.ButterKnife.bind(ButterKnife.java:124)
                                                                               at fr.free.nrw.commons.auth.LoginActivity.onCreate(LoginActivity.java:95)
                                                                               at android.app.Activity.performCreate(Activity.java:6847)
                                                                               at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                                                                               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2649)
                                                                               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2757) 
                                                                               at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4553) 
                                                                               at android.app.ActivityThread.-wrap19(ActivityThread.java) 
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1512) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                               at android.os.Looper.loop(Looper.java:163) 
                                                                               at android.app.ActivityThread.main(ActivityThread.java:6237) 
                                                                               at java.lang.reflect.Method.invoke(Native Method) 
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877) 
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

Device and Android version:

Android 7 MIUI V9.0

Commons app version:

2.6.7-debug-master~e9602f5

Screen-shots:

crashgif

I am working on the issue

Can anybody confirm the bug?

Update

TextView
android:id="@+id/login_credentials"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title"
android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginLeft="@dimen/standard_gap"
android:layout_marginRight="@dimen/standard_gap"
android:layout_marginStart="@dimen/standard_gap"
android:paddingBottom="@dimen/small_gap"
android:paddingTop="@dimen/small_gap"
android:textAlignment="center"
android:textColor="@color/secondaryDarkColor"
tools:text="@string/login_credential"

This TextView is only present in portrait mode of activity_login.xml
Added this to landscape and x-large activity_login.xml solves the bug.
PR #1208 fixes this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions