我在开发者控制台中遇到了奇怪的错误:
java.lang.RuntimeException: Unable to start activity ComponentInfo{my.package/my.package.Main}: java.lang.NumberFormatException: Invalid int: "res/drawable/title_bar.xml"
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1748)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1764)
at android.app.ActivityThread.access$1500(ActivityThread.java:122)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1002)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4025)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NumberFormatException: Invalid int: "res/drawable/title_bar.xml"
at java.lang.Integer.invalidInt(Integer.java:129)
at java.lang.Integer.parse(Integer.java:366)
at java.lang.Integer.parseInt(Integer.java:357)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:123)
at android.content.res.TypedArray.getInt(TypedArray.java:254)
at android.view.animation.Animation.<init>(Animation.java:244)
at android.view.animation.ScaleAnimation.<init>(ScaleAnimation.java:63)
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:118)
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:91)
at android.view.animation.AnimationUtils.loadAnimation(AnimationUtils.java:72)
at my.package.FragmentGameType.onActivityCreated(FragmentGameType.java:111)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1468)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:931)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:551)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1132)
at android.app.Activity.performStart(Activity.java:4371)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1721)
... 11 more
这是FragmentGameType.java的代码:
110. animZoomIn = AnimationUtils.loadAnimation(getActivity(), R.anim.zoom_in);
111. animZoomOut = AnimationUtils.loadAnimation(getActivity(), R.anim.zoom_out);
112. animZoomInRot = AnimationUtils.loadAnimation(getActivity(), R.anim.zoom_in_rot);
113. animZoomOutRot = AnimationUtils.loadAnimation(getActivity(), R.anim.zoom_out_rot);
有没有人有任何想法?
答案 0 :(得分:1)
尝试检查动画xml文件,
我在android 2.3中测试我的代码时出现了类似的崩溃,问题是某些句子的动画定义,看起来像行:
机器人:fromXScale =&#34; 1%&#34;
机器人:toXScale =&#34; 100%&#34;
我更改了代码:
机器人:fromXScale =&#34; 0.1&#34;
机器人:toXScale =&#34; 1.0
问题解决了。