FolioReader / FolioReader-Android

A Java ePub reader and parser framework for Android.
BSD 3-Clause "New" or "Revised" License
2.25k stars 718 forks source link

Crash on SearchActivity #274

Closed losscommand closed 6 years ago

losscommand commented 6 years ago

Issue / Feature - Issue FolioReader version - 0.4.2 FolioReader Stock / Modified - Stock Android SDK - 7.0 Mobile / Tablet / Emulator Info - Samsung Galaxy J7 (2016) Crash / Error - Crash

Steps to reproduce / Describe in detail -

App crash when I tap search. The library is included as module.

Here is the message i get.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.karv.lxphlaws/com.folioreader.ui.folio.activity.SearchActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.Toolbar.addOnLayoutChangeListener(android.view.View$OnLayoutChangeListener)' on a null object reference
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2984)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
                      at android.app.ActivityThread.-wrap14(ActivityThread.java)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:154)
                      at android.app.ActivityThread.main(ActivityThread.java:6776)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.Toolbar.addOnLayoutChangeListener(android.view.View$OnLayoutChangeListener)' on a null object reference
                      at com.folioreader.ui.folio.activity.SearchActivity.init(SearchActivity.kt:113)
                      at com.folioreader.ui.folio.activity.SearchActivity.onCreate(SearchActivity.kt:106)
                      at android.app.Activity.performCreate(Activity.java:6956)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045) 
                      at android.app.ActivityThread.-wrap14(ActivityThread.java) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:154) 
                      at android.app.ActivityThread.main(ActivityThread.java:6776) 
                      at java.lang.reflect.Method.invoke(Native Method) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408) 
hrishikesh-kadam commented 6 years ago

@losscommand @lekhrajtiwari Hey guys are you sure you haven't modified the FolioReader code? I am unable to reproduce the bug.

lekhrajtiwari commented 6 years ago

@hrishikesh-kadam @mahavir155 is there any way to disable the search view in 0.4.3

lekhrajtiwari commented 6 years ago

@losscommand @hrishikesh-kadam I just found the solution for it, in my case, two libraries with the identical name scheme were creating the conflict. so I suggest importing the library as a module after making some mirror changes in the menu item names

cheers to the filio team.

mahavir155 commented 6 years ago

Glad that you solve the issue yourself. Closing the issue.

MrOluGbenga commented 5 years ago

@lekhrajtiwari Could you please provide a guide on exactly what you did? I'm having the same issue.

losscommand commented 5 years ago

I had another menu item with the same name. Had to rename it. Check your other menus from other module too.

hrishikesh-kadam commented 5 years ago

@OluGbengae86 @losscommand @lekhrajtiwari Please let us know which menu item you had to rename, so that we can rename FolioReader's menu item uniquely to avoid any conflict.

MrOluGbenga commented 5 years ago

@lekhrajtiwari Kindly let's know which menu item, mine not working yet.

kvegilla commented 5 years ago

@hrishikesh-kadam @OluGbengae86 It was "itemSearch" in main_menu.xml. maybe change it into "itemSearchFolio"

MrOluGbenga commented 5 years ago

@hrishikesh-kadam @lekhrajtiwari So I found the issue. The source of the problem is at com.folioreader.ui.folio.activity.SearchActivity.init(SearchActivity.kt:113)

"SearchActivity.java" was created when I added a search functionality to my app. I simply renamed the activity and the related "activity_search.xml" file and now it's working again.

Thanks guys

losscommand commented 5 years ago

Must be a different case. Good to know that there's another solution.