Home > Mobile >  Android stadio flash back after importing the project started
Android stadio flash back after importing the project started

Time:09-18

Project is moved out of SVN, environment configuration completely, not the red, but after launch, enter the start page then flash back, error reason is a null pointer exception, error location on the front page of a setTextColor method, but the examination, the set of color. XML is exist, commented after the cover page of a button setOnTouchListener null pointer, also check for a long time also didn't found the problem, ask bosses help

CodePudding user response:

The mistake is not very clear, a null pointer, the object is null, you can visit the 331 lines

CodePudding user response:

reference 1st floor BDMH response:
this error is not very clear, null pointer, the object is null, you went to 331 rows

But this is after the launch into the home page, not to do any operation, are no problem before, nothing change, went out at home, that's it, is more than that, all the set is null pointer

CodePudding user response:

You know debugged

CodePudding user response:

reference BDMH reply: 3/f
debug once you know

Have to debug a afternoon, also check the file within the set, also check the R package, can think of way to try, still won't do

CodePudding user response:

reference BDMH reply: 3/f
debug once you know

And I will direct setText (" 123 "), is this newspaper null Pointers, I wonder whether this button, the statement when there is something wrong with but could not find where the problem, @ BindView (R.i which v_activity_home_community)
TextView tvActivityHomeCommunity;
Such a statement directly, then tvActivityHomeCommunity setXXX

CodePudding user response:

Direct breakpoint debugging, running step by step to here to see the null

CodePudding user response:

Is the most beautiful in the onCreate lookup controls, if it is, Suggestions on the onStart, etc

CodePudding user response:

Are generally not delete all light, run it, if you have problems is the environment right, can run again add code, bit by bit to find the error

CodePudding user response:

Null pointer exception well solve:
Null pointer exception causes: 1. No assignment statements, 2. The logic of assignment returns null, (3) assignment logic has not been performed before (code execution order wrong) (from a novice blog: https://blog.csdn.net/weimingjue/article/details/87921494)

1. No assignment statements, such as the statement is called directly, using a third-party annotation but annotations failure
2. Assignment logic returns null, such as: find the result of the wrong, of course, will return null, use third party comments but I can't find annotations
3. The logical sequence errors, such as: you put the TV. The setxxx on before onCreate, such a call first natural not

There are often around the place of the dead:
1. Are you a third party of the annotations, can see the butter knife you have correctly generated xxxxActivity_binding class
2. Your XML and XML in TV (may lead to you a few months is not transferred), such as: your Activity of XML is home_activit XML, but you hand write tv_activity_home_community residue in the home_fragment. In XML, at this time, please take a closer look at! Take a closer look at! Take a closer look at! Whether your XML

CodePudding user response:

This problem is not have any resource problem, this should be your control initialization problem, textview uninitialized, or textview initialization has a problem,

CodePudding user response:

Is to emphasize your textview is null, the null pointer exception is not have "textview. SetText is... , "said TextView is null
  • Related