但这不是正确的解决方案。 没有与资源ID同名的文件:
下面的当前工作目录是app/src/main/res
:
git ls-files . | cut -d "/" -f 2 | sed 's/\.xml//g' > /tmp/a
cat values/ids.xml | cut -d "\"" -f 2 > /tmp/b
cat /tmp/a | while read line; do grep -w $line /tmp/b; done
这没有结果。
此外,values/ids.xml
cat values/ids.xml | cut -d "\"" -f 2 | sort | wc -l
96
cat values/ids.xml | cut -d "\"" -f 2 | sort | uniq | wc -l
96
当我通过闹钟重启应用程序时发生异常。
...
alm.set(AlarmManager.RTC, System.currentTimeMillis() + 1000,
PendingIntent.getActivity(this, 0, new Intent(
this, LauncherActivity.class), 0));
Process.killProcess(Process.myPid());
...
然后它在LauncherActivityies onCreate
之前崩溃:
java.lang.RuntimeException: Unable to start activity ComponentInfo{ba.euroexpress.izvidjac/ba.euroexpress.traffictool.android.activites.MainActivity}: java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.CompoundButton$SavedState
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2779)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2857)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1590)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6499)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.CompoundButton$SavedState
at android.widget.CompoundButton.onRestoreInstanceState(CompoundButton.java:563)
at android.view.View.dispatchRestoreInstanceState(View.java:17726)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3751)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3751)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3751)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3751)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3751)
at android.view.View.restoreHierarchyState(View.java:17704)
at android.support.v4.app.Fragment.restoreViewState(Fragment.java:415)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1454)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1759)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1827)
at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3244)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3200)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:195)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:597)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1334)
at android.app.Activity.performStart(Activity.java:7019)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2742)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2857)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1590)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6499)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
导致此行为的原因是什么? 它发生在内存不足的情况下以及以这种方式重新启动应用程序时。
另请注意,我不在任何地方使用CompoundButton
课程。
git grep CompoundButton
// no results