无法找到资源ID。哪一个?

时间:2015-11-03 18:18:38

标签: android-studio

我收到以下错误。错误日志表明它无法找到资源ID。哪个ID,我仍然无能为力

11-03 09:59:32.821 9269-9269/com.example.ospunelap_130.hrs E/BluetoothAdapter: Bluetooth binder is null
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs W/ResourceType: Failure getting entry for 0x7f040019 (t=3 e=25) (error -75)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs D/AndroidRuntime: Shutting down VM
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime: FATAL EXCEPTION: main
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime: Process: com.example.ospunelap_130.hrs, PID: 9269
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ospunelap_130.hrs/com.example.ospunelap_130.hrs.hrm.HRSActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f040019
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.app.ActivityThread.-wrap11(ActivityThread.java)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:148)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5417)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:  Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f040019
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.content.res.Resources.getValue(Resources.java:1351)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.content.res.Resources.loadXmlResourceParser(Resources.java:2774)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.content.res.Resources.getLayout(Resources.java:1165)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:257)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at com.example.ospunelap_130.hrs.hrm.HRSActivity.onCreateView(HRSActivity.java:46)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at com.example.ospunelap_130.hrs.profile.BleProfileActivity.onCreate(BleProfileActivity.java:68)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.app.Activity.performCreate(Activity.java:6237)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102) 
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:148) 
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5417) 
11-03 09:59:32.843 9269-9269/com.example.ospunelap_130.hrs

错误:引起:android.content.res.Resources $ NotFoundException:资源ID#0x7f040019

Also Please tell me how dd you concluded the resource ID.

TIA :)

1 个答案:

答案 0 :(得分:0)

HRSActivity#onCreateView()内部,您正在调用setContentView(...),它会尝试使用ID(类似R.layout.hrs_activity

来夸大您指定的布局

我建议您首先确定您传递的是有效的布局ID,而不是任何其他类型。您拥有合法ID的事实告诉我您可能传递的不是布局类型。