Infeasible
Status Update
Comments
ma...@gmail.com <ma...@gmail.com> #2
Hi, I have the same error in my app. It seems the error occurs only on some LG devices with Android 4.1
je...@gmail.com <je...@gmail.com> #3
Same here: developer console reports Android 4.1 on LG Optimus L3 II (vee3e)
an...@gmail.com <an...@gmail.com> #4
Same here, Android 4.1, LG Optimus L9 (u2)
mi...@gmail.com <mi...@gmail.com> #5
Hello,
I have an LG Optimus L9 Android 4.1 and I have the same error in my app.
If I try in emulator with same version of android everything works fine!!!
The problem in on LG
I have an LG Optimus L9 Android 4.1 and I have the same error in my app.
If I try in emulator with same version of android everything works fine!!!
The problem in on LG
ho...@gmail.com <ho...@gmail.com> #6
See many error reports from Google Play about this issue, all are from LG devices.
Do you guy have any workarounds for this problem?
And Google, why do u ignore this issue? Many people can't use feature hidden in overflow button right now...
Do you guy have any workarounds for this problem?
And Google, why do u ignore this issue? Many people can't use feature hidden in overflow button right now...
ma...@gmail.com <ma...@gmail.com> #7
It seems there is a workaround here : http://developer.lge.com/community/forums/RetrieveForumContent.dev?detailContsId=FC29190703
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU){
openOptionsMenu();
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU){
openOptionsMenu();
return true;
}
return super.onKeyDown(keyCode, event);
}
ta...@gmail.com <ta...@gmail.com> #8
#6: Note that `Activity.openOptionsMenu()` might work on those affected LG devices (I haven't tried), but it generally won't work with AppCompat (it's a no-op).
A potential solution may be to catch the NPE `onKeyUp()` and then call `openOptionsMenu()` there. If going that route, no need to override `onKeyDown()` either.
A potential solution may be to catch the NPE `onKeyUp()` and then call `openOptionsMenu()` there. If going that route, no need to override `onKeyDown()` either.
hb...@gmail.com <hb...@gmail.com> #9
@5 - it looks like this is a bug with LG's customised version of Android. There's nothing this website can do here to help if a manufacturer chooses to do something that introduces bugs on their devices only.
mo...@gmail.com <mo...@gmail.com> #10
@8 - it looks that the bug is related to the latest appcompat library v7.
I developed an application that was working fine with older versions of the library, but after I upgraded the application source code including the revision 21 of the appcompat I started to receive lots of NPE from LG devices with hardware option button.
So the NPE was caused by the new Appcompat library, which indicates that Google did not perform any regression tests on these devices.
Why older versions of Appcompat works well with LG phones?
Note that no one from Google team has yet provided any answer, which is really unprofessional.
I developed an application that was working fine with older versions of the library, but after I upgraded the application source code including the revision 21 of the appcompat I started to receive lots of NPE from LG devices with hardware option button.
So the NPE was caused by the new Appcompat library, which indicates that Google did not perform any regression tests on these devices.
Why older versions of Appcompat works well with LG phones?
Note that no one from Google team has yet provided any answer, which is really unprofessional.
al...@gmail.com <al...@gmail.com> #11
@9 The fact that only LG devices are affected is proof that it is a bug made by LG. The appcompat library is not device-specific, so how could this be considered Google's problem if their implementation works fine on thousands of other devices? Google should be allowed to alter the implementation of the appcompat library without having to worry about bugs that LG and other OEMs introduced in their code.
ho...@gmail.com <ho...@gmail.com> #12
agree with #10 but Google is the only one can help developers to fix this problem. If they don't fix then many many many Android users can't use menu button anymore.
re...@netmoms.de <re...@netmoms.de> #13
That workaround in #6 does not work for my customers. Any ideas?
so...@aps.anl.gov <so...@aps.anl.gov> #14
I had to override both the keyDown and keyUp events.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_MENU) &&
(Build.VERSION.SDK_INT == 16) &&
(Build.MANUFACTURER.compareTo("LGE") == 0)) {
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_MENU) &&
(Build.VERSION.SDK_INT == 16) &&
(Build.MANUFACTURER.compareTo("LGE") == 0)) {
openOptionsMenu();
return true;
}
return super.onKeyUp(keyCode, event);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_MENU) &&
(Build.VERSION.SDK_INT == 16) &&
(Build.MANUFACTURER.compareTo("LGE") == 0)) {
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_MENU) &&
(Build.VERSION.SDK_INT == 16) &&
(Build.MANUFACTURER.compareTo("LGE") == 0)) {
openOptionsMenu();
return true;
}
return super.onKeyUp(keyCode, event);
}
al...@gmail.com <al...@gmail.com> #15
I was able to avoid the issue by using the following code in my activities:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && "LGE".equalsIgnoreCase(Build.BRAND)) {
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && "LGE".equalsIgnoreCase(Build.BRAND)) {
openOptionsMenu();
return true;
}
return super.onKeyUp(keyCode, event);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && "LGE".equalsIgnoreCase(Build.BRAND)) {
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && "LGE".equalsIgnoreCase(Build.BRAND)) {
openOptionsMenu();
return true;
}
return super.onKeyUp(keyCode, event);
}
al...@gmail.com <al...@gmail.com> #16
This bug is still not fixed in appcompat-v7 version 21.0.2.
xm...@gmail.com <xm...@gmail.com> #17
Still on appcompat-v7 version 21.0.3
al...@gmail.com <al...@gmail.com> #18
#15 and #16 - It's a bug on LG's end, not the support library's. You'll probably have to wait until LG fixes the bug themselves (or use a workaround like in #13 or #14).
jt...@googlemail.com <jt...@googlemail.com> #19
This bug is a serious issue and we all know that LG won't update any Android 4.1 devices.
m4...@gmail.com <m4...@gmail.com> #20
Android4.0.4 made of LG also I crashed.
"Build.BRAND" is not valid.
There is a terminal that does not appear as "LGE".
*It was a contract carrier in my terminal.
Measures that I'm using is the following.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_MENU) &&
(Build.VERSION.SDK_INT <= 16) &&
(Build.MANUFACTURER.compareTo("LGE") == 0)) {
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_MENU) &&
(Build.VERSION.SDK_INT <= 16) &&
(Build.MANUFACTURER.compareTo("LGE") == 0)) {
openOptionsMenu();
return true;
}
return super.onKeyUp(keyCode, event);
}
"Build.BRAND" is not valid.
There is a terminal that does not appear as "LGE".
*It was a contract carrier in my terminal.
Measures that I'm using is the following.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_MENU) &&
(Build.VERSION.SDK_INT <= 16) &&
(Build.MANUFACTURER.compareTo("LGE") == 0)) {
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_MENU) &&
(Build.VERSION.SDK_INT <= 16) &&
(Build.MANUFACTURER.compareTo("LGE") == 0)) {
openOptionsMenu();
return true;
}
return super.onKeyUp(keyCode, event);
}
ps...@gmail.com <ps...@gmail.com> #21
While there are apparently not the same NullPointerExceptions, we've received reports of hardware menu button functionality not working (sounds a no-op) on an LG G2 running Android 4.2.
ps...@gmail.com <ps...@gmail.com> #22
I'm certain Google won't approve of the workaround, but this is the most reliable way we've found to keep everything in our app functional using AppCompat v21:
@Override
protected void onCreate(Bundle savedInstanceState) {
if (isMenuWorkaroundRequired()) {
forceOverflowMenu();
}
super.onCreate(savedInstanceState);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return (keyCode == KeyEvent.KEYCODE_MENU && isMenuWorkaroundRequired()) || super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && isMenuWorkaroundRequired()) {
openOptionsMenu();
return true;
}
return super.onKeyUp(keyCode, event);
}
public static boolean isMenuWorkaroundRequired() {
return VERSION.SDK_INT < VERSION_CODES.KITKAT &&
VERSION.SDK_INT > VERSION_CODES.GINGERBREAD_MR1 &&
("LGE".equalsIgnoreCase(Build.MANUFACTURER) || "E6710".equalsIgnoreCase(Build.DEVICE));
}
/**
* Modified from:http://stackoverflow.com/a/13098824
*/
private void forceOverflowMenu() {
try {
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if(menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (IllegalAccessException | NoSuchFieldException e) {
Log.w(TAG, "Failed to force overflow menu.");
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
if (isMenuWorkaroundRequired()) {
forceOverflowMenu();
}
super.onCreate(savedInstanceState);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return (keyCode == KeyEvent.KEYCODE_MENU && isMenuWorkaroundRequired()) || super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU && isMenuWorkaroundRequired()) {
openOptionsMenu();
return true;
}
return super.onKeyUp(keyCode, event);
}
public static boolean isMenuWorkaroundRequired() {
return VERSION.SDK_INT < VERSION_CODES.KITKAT &&
VERSION.SDK_INT > VERSION_CODES.GINGERBREAD_MR1 &&
("LGE".equalsIgnoreCase(Build.MANUFACTURER) || "E6710".equalsIgnoreCase(Build.DEVICE));
}
/**
* Modified from:
*/
private void forceOverflowMenu() {
try {
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
if(menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (IllegalAccessException | NoSuchFieldException e) {
Log.w(TAG, "Failed to force overflow menu.");
}
}
sa...@gmail.com <sa...@gmail.com> #23
I've made an Xposed module that fixes this bug. You should be able to install it if your phone is rooted and you have the Xposed installer.
Seehttp://repo.xposed.info/module/com.saikrishna.lgmenubuttonfix
See
fc...@gmail.com <fc...@gmail.com> #24
If it's worth to mention the problem doesn't seem to occur when using Support v7 22.0.1 .. I create a git repo:
https://github.com/fcduarte/deckard-gradle
that contains a Espresso test for calling the hardware button. I tested it onappthwack.com using all their LG 4.1.2 devices and I don't see the crash anymore .. Can someone else confirm?
Also maybe it'd be nice to investigate the differences between 21 and 22 to discover how it was fixed.
that contains a Espresso test for calling the hardware button. I tested it on
Also maybe it'd be nice to investigate the differences between 21 and 22 to discover how it was fixed.
fc...@gmail.com <fc...@gmail.com> #25
@22: can you share the source code?
sa...@gmail.com <sa...@gmail.com> #27
It looks like this was fixed in a recent update of the support library (22.2, maybe?). Using the fix above will result in the menu key _not_ working (but with no crash).
ch...@google.com <ch...@google.com> #28
The LG menu bug was fixed in v22.0 IIRC.
tr...@gmail.com <tr...@gmail.com> #29
Do you have further information where this error was affecting?
I was using version of appcompat 21.0.3, but the error output was different:
(notice the location of the exception in the code is different):
java.lang.NullPointerException
at com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:987)
at com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java:1686)
...
I was using version of appcompat 21.0.3, but the error output was different:
(notice the location of the exception in the code is different):
java.lang.NullPointerException
at com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:987)
at com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java:1686)
...
Description
Version used: 21
The crash happens on Android 4.1 device pressing the options menu hardware button, running the ActionBarUsage included in the Support7Demos from the latest Android SDK.
The problem is apparently related to the v7 appcompat support library revision 21 library. Here is a stack trace when the option menu hardware button is pressed:
FATAL EXCEPTION: main
java.lang.NullPointerException
at com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:1004)
at com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java:1712)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2125)
at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3611)
at android.view.ViewRootImpl.handleImeFinishedEvent(ViewRootImpl.java:3581)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:2831)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4929)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:798)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:565)
at dalvik.system.NativeStart.main(Native Method)