weixin_39816448 2020-11-21 17:26
浏览 0

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

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,871540,1167} 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

该提问来源于开源项目:freeotp/freeotp-android

  • 写回答

6条回答 默认 最新

  • weixin_39816448 2020-11-21 17:26
    关注

    Modified by anisse on 21 Nov 2014 10:26 UTC

    评论

报告相同问题?