Solving Already created an SDK Loader with different SDK Path Problem with Android Studio

As I mentionned in the previous post I'm on the process of migrating from Eclipse to Android Studio for developing android applications and simple games and in the same time I'm writing a series of small posts to show other developers how I solved the problems i encoutered during this process of migration.

This post outlines how I got and solved

Already created an SDK Loader with different SDK Path

The problem showed up when trying to import a generated gradle project(Using the LibGDX Project Generator) from Android studio which uses a different Android SDK than the default one used by Android studio.The IDE detected the difference and asked which one to consider ,i choosed the one pointed by the project.

How to solve the error

You can solve this problem in two ways you either change of your project file to exactly reflect the sdk path used by Android Studio, if that causes any problem for your project you can then change the default SDK used by Android Studio.

How to change the default SDK used by Android Studio

Changing the default SDK used by Android SDK is easy.On the left pane where your project structure shows up ,right click on your project name

The right menu will popups go to module settings anc click on it

Now the Project strcuture window will show up ,Under Android SDK location choose where your Android SDK lives by browsing your filesystem.

Then just click on Ok and restart Android Studio for changes to take effect.

How to change the local SDK used by your project

If you want to just change your project's sdk and leave the default Android Studio SDK unchanged you can use the file and set sdk.dir variable to point to the path of an Android SDK folder.

# Location of the android SDK

If the file doesn't exist in the root of your project ,exactly where and build.gradle exist,just create it by yourself.

Projects which have a file with an sdk.dir property will use the chosen sdk insted of the default SDK of Android Studio.

That's all ,I hope this post will help solve your problem too and happy migrating from Eclipse to Android Studio.

Note: We also publish our tutorials on Medium and If you prefer reading in these platforms, you can follow us there to get our newest articles.

You can reach the author via Twitter:

About the author

Ahmed Bouchefra
is a web developer with 5+ years of experience and technical author with an engineering degree on software development. You can hire him with a click on the link above or contact him via his LinkedIn account. He authored technical content for the industry-leading websites such as SitePoint, Smashing, DigitalOcean, RealPython, freeCodeCamp, JScrambler, Pusher, and Auth0. He also co-authored various books about modern web development that you can find from Amazon or Leanpub

Get our Learn Angular 8 in 15 Easy Steps ebook in pdf, epub and mobi formats, plus a new Angular 8 tutorial every 3 days.

comments powered by Disqus Protection Status