简体   繁体   中英

Set up JDK error....in android Studio

i was just working in my code and all of a sudden my android studio shows underlining all over the program. i am not able to guess what is the error

things i tried:- Restating rebooting creating alternate project reinstalling android studio

but the error seems inconvincable but one thing i noticed is that the red underline seems to only come for java files and not xml files

Please click here for the image

to add more information.. basic things like imageview content menu item inflater are going red

Is red lines displaying in all of your activities if yes then then there is some error in one of your projects xml file. Find it out. Check messages in android studio. let know if you cant figure it out

尝试Build > Clean ProjectGradle > Refresh all projects

there is something called -

packagename.R ex: com.example.R .

Check for this in imports of .java file there should be this line like

import com.example.R

, if its there then this is because there is error in your xml file in values or menu or layout probably on some id.

If jdk is issue then

  1. if Ubuntu - do - > sudo apt-get install openjdk-8-jdk -here first check what version of java you have

  2. if its is windows setup your jdk/jre in environment variables to java 8

    For these two steps you will get lot of links from google.

    if still it is not resolved last option then try redo the last step due to which this error has occurred.

Try creating another android project and see your getting same errors in java file, if no then its not jdk issue this is something has to do with you project R file as there is some error in your xml files. Try to clean/re-build project.

Post your code if possible

NOTE YOUR PROBLEM LIES ONLY IN THIS SCOPE. THERE CANNOT BE ANY OTHER REASONS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM