2

Can't compile the tutorial code in Android Studio without switching to an older API. Anyone know why that is? Does it have any relevance to the API supported by the emulated device?

Comments
  • 0
    are you using any deprecated methods?
  • 0
    Yes, if you're using an emulator it compiles to its API version. You initially set a target API version when setting up a project, though, and that's what it usually defaults to.
  • 0
    @liveCoder Don't think so. I'm literally talking about the tutorial from Android Studio, like the blank activity.
  • 0
    @julianmd btw what do you mean by switching to an older API?
  • 1
    @liveCoder Android apps call OS APIs, if I understand correctly, and those get updated which each new major version. Some devices support new ones, others only old ones and, based on that, you make your app available to more users (by decreasing the minimum API version requirement in your app). And you have the option of selecting your API, but when you first start Android Studio, the main documentation page says to keep it as default (API 24), although it returns compilation errors upon running the simplest template, due to the emulated device (AS always emulates your code, apparently) not supporting API 24. I think that's what happens.
  • 1
    @Trey50Daniel Thanks for the explanation, could you take a look at my other comment and let me know how much of it I got wrong? Thanks!
  • 1
    @julianmd Everything you said sounds good, but I'll just have to add a couple of things. You also have to mind the view, because different APIs allow different layouts, etc. Android Studio just gives you all of the tools to change what you want, but doesn't really tell you how to use them. It's like getting A Swiss Army Knife with all the tools open and trying to use them all at once.
  • 1
    @julianmd hmn so you set the minimum sdk version to api version 24?
  • 0
    @liveCoder actually, I set it to 23.0.3 or somethingh among those lines.
  • 1
    @Trey50Daniel Thanks for taking a look and letting me know!
  • 0
    @julianmd thats not the min sdk version, that must be the compile sdk version, go to your app folder open the build. gradle file and find min sdk version and see what number is
Add Comment