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
Question posted in Android Studio
The official documentation can be found here.
The official documentation can be found here.
2
Answers
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 withEnter
(or keep typing to get better suggestions). Move with arrows in the window. IntelliJ will then auto import the class.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.