skip to Main Content

I’m trying to code a simple android app for something and I was wondering if there was an alternative to importing each class manually, or why it shows up as red since anytime I write something in a similar way it won’t run. android studio screenshot

2

Answers


  1. To answer the first part:
    Yes there is a way to import classes manually. You could look through the code of the dependency and manually create the import statement. This is highly discouraged since it is tedious, time consuming and your IDE (IntelliJ IDEA in your case) is fully able to do this. But if you want to do it this way you can learn something about it here.

    To your second part:
    It shows red because the classes don’t exist or are not imported. As you know. To help more we will need the a screenshot of the error when you hover over the red text BUT if you think/know it is an import error you can try this:

    Hover over the red text and click Import Class if it shows up.

    If it does not show up, it means it does not exist or an other error is present. Then we will need a screenshot of the error to help further.

    Small hint (if you did not know already): When typing press ctrl+space a windows will pop up with suggestions for autocompletion. Select your options with Enter (or keep typing to get better suggestions). Move with arrows in the window. IntelliJ will then auto import the class.

    Login or Signup to reply.
  2. I did not see the Import Method option in the Quick Tips too, however, as mentioned above ctrl+space worked for me. As it shows up the required classes if they are present in your lib.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search