按ID投射查找视图是多余的

时间:2018-09-29 14:10:37

标签: java android

所有元素(ImageView,TextView,Button)都是黄色的,带有一些错误:“通过id铸造查找视图是多余的”,也是XML。

当我启动应用程序时,它只是崩溃了。没有红线,我也尝试过修复和构建->清洁项目。根本没有帮助...

请你帮我,我必须在星期一之前完成这个项目。

java

xml

部分代码:

private Button mButtonChoiceTrue;
private Button mButtonChoiceFalse;
mButtonChoiceTrue = (Button) findViewById(R.id.buttonTocno);
mButtonChoiceFalse = (Button) findViewById(R.id.buttonNetocno);

崩溃日志: 09-29 16:20:31.231 4814-4814/? I/zygote64: Late-enabling -Xcheck:jni 09-29 16:20:31.263 4814-4814/? I/zygote64: Reinit property: dalvik.vm.checkjni= false 09-29 16:20:31.292 4814-4814/? D/ActivityThread: ActivityThread,attachApplication 09-29 16:20:31.370 4814-4814/com.example.manue.rijekaquiz D/HwFLClassLoader: get used feature list :/feature/used-list failed! USE_FEATURE_LIST had not init! 09-29 16:20:31.536 4814-4814/com.example.manue.rijekaquiz I/InstantRun: starting instant run server: is main process 09-29 16:20:31.543 4814-4814/com.example.manue.rijekaquiz E/MemoryLeakMonitorManager: MemoryLeakMonitor.jar is not exist! 09-29 16:20:31.545 4814-4814/com.example.manue.rijekaquiz E/Minikin: Could not get cmap table size! 09-29 16:20:31.616 4814-4814/com.example.manue.rijekaquiz I/HwCust: Constructor found for class android.app.HwCustActivityImpl 09-29 16:20:31.617 4814-4814/com.example.manue.rijekaquiz D/HwCust: Create obj success use class android.app.HwCustActivityImpl 09-29 16:20:31.661 4814-4814/com.example.manue.rijekaquiz V/HwPolicyFactory: : success to get AllImpl object and return.... 09-29 16:20:31.667 4814-4814/com.example.manue.rijekaquiz I/HwCust: Constructor found for class android.app.HwCustHwWallpaperManagerImpl 09-29 16:20:31.667 4814-4814/com.example.manue.rijekaquiz D/HwCust: Create obj success use class android.app.HwCustHwWallpaperManagerImpl 09-29 16:20:31.675 4814-4814/com.example.manue.rijekaquiz V/HwWidgetFactory: : successes to get AllImpl object and return.... 09-29 16:20:31.685 4814-4814/com.example.manue.rijekaquiz V/ActivityThread: ActivityThread,callActivityOnCreate 09-29 16:20:31.808 4814-4814/com.example.manue.rijekaquiz D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97 09-29 16:20:31.809 4814-4814/com.example.manue.rijekaquiz D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0 09-29 16:20:31.810 4814-4814/com.example.manue.rijekaquiz D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97 09-29 16:20:31.811 4814-4814/com.example.manue.rijekaquiz D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0 09-29 16:20:31.878 4814-4814/com.example.manue.rijekaquiz W/Utils: Utils_isSuperResolutionSupport [load libai_client.so failed] 09-29 16:20:31.905 4814-4814/com.example.manue.rijekaquiz D/HwGalleryCacheManagerImpl: mIsEffect:false 09-29 16:20:31.924 4814-4814/com.example.manue.rijekaquiz D/HwRTBlurUtils: check blur style for HwPhoneWindow, themeResId : 0x7f0c0005, context : com.example.manue.rijekaquiz.RijekaQuiz@83de284, Nhwext : 0, get Blur : disable with , null 09-29 16:20:32.102 4814-4814/com.example.manue.rijekaquiz D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97 CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0 09-29 16:20:32.103 4814-4814/com.example.manue.rijekaquiz D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97 CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0 09-29 16:20:32.216 4814-4823/com.example.manue.rijekaquiz I/zygote64: Do partial code cache collection, code=20KB, data=29KB After code cache collection, code=20KB, data=29KB Increasing code cache capacity to 128KB 09-29 16:20:32.218 4814-4823/com.example.manue.rijekaquiz I/zygote64: Do partial code cache collection, code=20KB, data=50KB After code cache collection, code=20KB, data=50KB Increasing code cache capacity to 256KB 09-29 16:20:32.219 4814-4823/com.example.manue.rijekaquiz I/zygote64: Compiler allocated 8MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int) 09-29 16:20:32.229 4814-4814/com.example.manue.rijekaquiz D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97 09-29 16:20:32.230 4814-4814/com.example.manue.rijekaquiz D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0 09-29 16:20:32.231 4814-4814/com.example.manue.rijekaquiz D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97 09-29 16:20:32.232 4814-4814/com.example.manue.rijekaquiz D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0 09-29 16:20:32.330 4814-4814/com.example.manue.rijekaquiz D/AndroidRuntime: Shutting down VM 09-29 16:20:32.333 4814-4814/com.example.manue.rijekaquiz E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.manue.rijekaquiz, PID: 4814 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.manue.rijekaquiz/com.example.manue.rijekaquiz.RijekaQuiz}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.RelativeLayout.setVisibility(int)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3194) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3302) at android.app.ActivityThread.-wrap12(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891) at android.os.Handler.dispatchMessage(Handler.java:108) at android.os.Looper.loop(Looper.java:166) at android.app.ActivityThread.main(ActivityThread.java:7425) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.RelativeLayout.setVisibility(int)' on a null object reference at com.example.manue.rijekaquiz.RijekaQuiz.startScreen1(RijekaQuiz.java:403) at com.example.manue.rijekaquiz.RijekaQuiz.updateQuestion(RijekaQuiz.java:252) at com.example.manue.rijekaquiz.RijekaQuiz.onCreate(RijekaQuiz.java:149) at android.app.Activity.performCreate(Activity.java:7372) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1218) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3147) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3302)  at android.app.ActivityThread.-wrap12(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891)  at android.os.Handler.dispatchMessage(Handler.java:108)  at android.os.Looper.loop(Looper.java:166)  at android.app.ActivityThread.main(ActivityThread.java:7425)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)  09-29 16:20:32.369 4814-4823/com.example.manue.rijekaquiz I/zygote64: Do full code cache collection, code=96KB, data=73KB After code cache collection, code=93KB, data=63KB 09-29 16:20:32.406 4814-4814/com.example.manue.rijekaquiz I/Process: Sending signal. PID: 4814 SIG: 9

1 个答案:

答案 0 :(得分:0)

您的RelativeLayout为空。在代码中检查括号中的行。

Options -MultiViews