0

I have started using Android studio (intellij idea) for Android development (on Ubuntu 18.05) so I am very new to how it works and more used to visual studio :)

When I type a class name from Android API I note that ide mostly won't have suggestion as to which package to include. I find this to be a complete pain. For example if I type " ApiException aex;" IDE won't have any suggestions for what to include and will just report compile error.

I have various android libraries included in gradle and in the imports list so farily sure this class could be discovered by IDE (shouldn't this be java.lang.* or Google play services/GM's which I have in gradle?)

What is the easiest way to find which import I need for a class eg ApiException and is there a shortcut within Intellij to help with this?

Thank you

user9128309
  • 165
  • 11
  • 1
    If IntelliJ "knows" about the dependency, it should underline the class name. Hovering over that class, there should be an option to suggest dependencies. If your class isn't listed, then it means you have to include something in your build/POM file first. – Tim Biegeleisen Jul 10 '18 at 11:11
  • Thanks for response. Not sure this works in my studio (in fairness it works from time to time but not always even if all imports are there), for example what do you think I should have in my build list for ApiException? Fairly sure I have what is required but not 100% unsure so it would be good to check. – user9128309 Jul 10 '18 at 11:15
  • simple go to the error line `alt` + `Enter`, it will show the possible imports. But if you dont see the imports this means you haven't included some dependency in your gradle. And make sure your gradle is synced. – Abubakar Jul 10 '18 at 11:16
  • Thanks, alt enter does not show anything. Do you know what import os required for ApiException so I can check? – user9128309 Jul 10 '18 at 11:18
  • Adding to comments above, you can try with https://stackoverflow.com/questions/18370599/android-studio-auto-complete-and-other-features-not-working and this one https://medium.com/@mmbialas/50-android-studio-tips-tricks-resources-you-should-be-familiar-with-as-an-android-developer-af86e7cf56d2 – Sreehari Jul 10 '18 at 11:23

0 Answers0