Search code examples
androidandroid-studioandroid-sdk-toolsandroid-sdk-manager

Android Studio select SDK error on trying to run project


I am using Android Studio 3.1 on Ubuntu 18.04 LTS. I'm currently working on a project with target API 28. I've downloaded the SDK with API level 28 during installation but sometimes when I try to run my project on my device, a popup dialogue prompts me to select the SDK. This does not happen every time but happens sometimes even if I've run the project before and made no change to the SDK path. I don't know what triggers this. I've seen similar questions on StackOverflow, but none of the solutions work for me. Here's what I have done so far:

  • Synced my project
  • Invalidated cache and restart
  • closed my project and opened it again
  • Uninstalled my SDK and downloaded it again
  • Switched back to an older version of SDK and then back again

But none of this works and the only workaround I found was to open another project that I downloaded from Github (with API 26), build it and then go back to my current project. This solves it temporarily. A few of my friends are working on the same project on different machines (Windows, Mac) and they have this problem, too. Is this a bug with AS or is there a permanent solution?


Solution

  • I've found this workaround. It is not perfect, but it works. Hope this this will be helpful for someone else. Move your project folder to another location and then open it. It resolves the problem.