Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f080012

 一、
问题描述:在导入一个比较老的安卓项目后,运行时出现了Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f080012错误。

具体日志如下:

 

 1 09-16 12:40:35.741: E/AndroidRuntime(659): FATAL EXCEPTION: main
 2 09-16 12:40:35.741: E/AndroidRuntime(659): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.forchild000.surface/com.forchild000.surface.LoginActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x7f080012
 3 09-16 12:40:35.741: E/AndroidRuntime(659): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
 4 09-16 12:40:35.741: E/AndroidRuntime(659): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
 5 09-16 12:40:35.741: E/AndroidRuntime(659): at android.app.ActivityThread.access$600(ActivityThread.java:122)
 6 09-16 12:40:35.741: E/AndroidRuntime(659): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
 7 09-16 12:40:35.741: E/AndroidRuntime(659): at android.os.Handler.dispatchMessage(Handler.java:99)
 8 09-16 12:40:35.741: E/AndroidRuntime(659): at android.os.Looper.loop(Looper.java:137)
 9 09-16 12:40:35.741: E/AndroidRuntime(659): at android.app.ActivityThread.main(ActivityThread.java:4340)
10 09-16 12:40:35.741: E/AndroidRuntime(659): at java.lang.reflect.Method.invokeNative(Native Method)
11 09-16 12:40:35.741: E/AndroidRuntime(659): at java.lang.reflect.Method.invoke(Method.java:511)
12 09-16 12:40:35.741: E/AndroidRuntime(659): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
13 09-16 12:40:35.741: E/AndroidRuntime(659): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
14 09-16 12:40:35.741: E/AndroidRuntime(659): at dalvik.system.NativeStart.main(Native Method)
15 09-16 12:40:35.741: E/AndroidRuntime(659): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f080012
16 09-16 12:40:35.741: E/AndroidRuntime(659): at android.content.res.Resources.getText(Resources.java:247)
17 09-16 12:40:35.741: E/AndroidRuntime(659): at android.content.Context.getText(Context.java:265)
18 09-16 12:40:35.741: E/AndroidRuntime(659): at android.app.Activity.setTitle(Activity.java:4024)
19 09-16 12:40:35.741: E/AndroidRuntime(659): at com.forchild000.surface.LoginActivity.onCreate(LoginActivity.java:50)
20 09-16 12:40:35.741: E/AndroidRuntime(659): at android.app.Activity.performCreate(Activity.java:4465)
21 09-16 12:40:35.741: E/AndroidRuntime(659): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
22 09-16 12:40:35.741: E/AndroidRuntime(659): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
23 09-16 12:40:35.741: E/AndroidRuntime(659): ... 11 more

 


二、
解决:错误原因是资源找不到,这里先删除项目的gen和bin目录,然后会自动生成这两个目录,最后clean,build一下即可。

Variety is the spice of life.

posted @ 2020-09-17 11:10  晓风残月龙  阅读(596)  评论(0编辑  收藏  举报