Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash at startup on Lollipop: the key must be an application-specific resource id #47

Closed
npmccallum opened this issue Oct 24, 2016 · 6 comments

Comments

@npmccallum
Copy link
Contributor

Reported by anisse on 21 Nov 2014 10:25 UTC
The app crashes on Lollipop on start. Here is the logcat:

I/ActivityManager( 749): START u0 {act=android.intent.action.MAIN cat=[flg=0x10200000 cmp=org.fedorahosted.freeotp/.MainActivity bnds=276,871[540,1167](has extras)} from uid 10022 on display 0
I/ActivityManager( 749): Start proc org.fedorahosted.freeotp for activity org.fedorahosted.freeotp/.MainActivity: pid=7785 uid=10131 gids={50131, 9997, 3003, 1028} abi=armeabi-v7a
D/OpenGLRenderer( 7785): Render dirty regions requested: true
D/Atlas ( 7785): Validating map...
D/AndroidRuntime( 7785): Shutting down VM
E/AndroidRuntime( 7785): FATAL EXCEPTION: main
E/AndroidRuntime( 7785): Process: org.fedorahosted.freeotp, PID: 7785
E/AndroidRuntime( 7785): java.lang.IllegalArgumentException: The key must be an application-specific resource id.
E/AndroidRuntime( 7785): at android.view.View.setTag(View.java:17185)
E/AndroidRuntime( 7785): at org.fedorahosted.freeotp.BaseReorderableAdapter.getView(BaseReorderableAdapter.java:101)
E/AndroidRuntime( 7785): at android.widget.AbsListView.obtainView(AbsListView.java:2344)
E/AndroidRuntime( 7785): at android.widget.GridView.onMeasure(GridView.java:1060)
E/AndroidRuntime( 7785): at android.view.View.measure(View.java:17430)
E/AndroidRuntime( 7785): at android.widget.LinearLayout.measureVertical(LinearLayout.java:875)
E/AndroidRuntime( 7785): at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
E/AndroidRuntime( 7785): at android.view.View.measure(View.java:17430)
E/AndroidRuntime( 7785): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
E/AndroidRuntime( 7785): at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
E/AndroidRuntime( 7785): at android.view.View.measure(View.java:17430)
E/AndroidRuntime( 7785): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
E/AndroidRuntime( 7785): at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:447)
E/AndroidRuntime( 7785): at android.view.View.measure(View.java:17430)
E/AndroidRuntime( 7785): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
E/AndroidRuntime( 7785): at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
E/AndroidRuntime( 7785): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2560)
E/AndroidRuntime( 7785): at android.view.View.measure(View.java:17430)
E/AndroidRuntime( 7785): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2001)
E/AndroidRuntime( 7785): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1166)
E/AndroidRuntime( 7785): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1372)
E/AndroidRuntime( 7785): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
E/AndroidRuntime( 7785): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
E/AndroidRuntime( 7785): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
E/AndroidRuntime( 7785): at android.view.Choreographer.doCallbacks(Choreographer.java:580)
E/AndroidRuntime( 7785): at android.view.Choreographer.doFrame(Choreographer.java:550)
E/AndroidRuntime( 7785): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
E/AndroidRuntime( 7785): at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime( 7785): at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 7785): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 7785): at android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime( 7785): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 7785): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 7785): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime( 7785): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
W/ActivityManager( 749): Force finishing activity org.fedorahosted.freeotp/.MainActivity

I might have reordered my OTPs.

Looking at the documentation of setView, it seems FreeOTP is doing something wrong:
https://developer.android.com/reference/android/view/View.html#setTag%28int,%20java.lang.Object%29
Indeed, the key argument should be declared in the resources, but this is not the case here:
L33: private static final int KEY = BaseReorderableAdapter.class.hashCode();

It might also be related to ART, but I don't know.

Regards,

Anisse

@npmccallum
Copy link
Contributor Author

Modified by anisse on 21 Nov 2014 10:26 UTC

@npmccallum
Copy link
Contributor Author

Modified by anisse on 21 Nov 2014 12:32 UTC

@npmccallum npmccallum changed the title Crash on Lollipop: the key must be an application-specific resource id Crash at startup on Lollipop: the key must be an application-specific resource id Oct 24, 2016
@npmccallum
Copy link
Contributor Author

Comment by anisse on 25 Nov 2014 09:26 UTC
I did more tests; it only appears on Nexus 5. I tried on a Nexus 9, FreeOTP works. It has nothing to do with reordering the list, as deleting all the data and/or reinstalling the app doesn't change anything: the app will crash as soon as one OTP token is added (via QR code).

@npmccallum
Copy link
Contributor Author

Comment by npmccallum on 25 Nov 2014 23:19 UTC
Can you please test the provided build?

@npmccallum
Copy link
Contributor Author

Comment by anisse on 26 Nov 2014 09:03 UTC
I just tried it on Nexus 5, it works ! App start, it even has the last scanned QR token registered.

Thanks,

Anisse

@npmccallum
Copy link
Contributor Author

Comment by npmccallum on 26 Nov 2014 19:00 UTC
Fixed by [e9b6626/android]. A new release is pending on Google Play to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant