I recently try to open Eclipse project to Android Studio that used targetSdk 16. But I forgot to change the target Sdk before importing to Android Studio. I have latest version of Android Sdk(19-22) so I dont want to install SDK 16.
But Android Studio is showing following error every time I try to build:
Error:failed to find target android-16 : D:\adt-bundle-windows-x86_64-20140702\sdk
Install missing platform(s) and sync project
How can I fix it and stop Android Studio from forcing me to install older version of SDK?
Step #1: Close Android Studio.
Step #2: Using a text editor, edit your build.gradle
files to be what you want in terms of compileSdkVersion
, minSdkVersion
, targetSdkVersion
, etc.
Step #3: Open Android Studio and attempt to use your project.
If you still encounter related problems, then:
Step #4: Close the project from within Android Studio (File > Close Project). This should leave you at the so-called "welcome dialog", listing past projects and options for starting or importing new projects.
Step #5: Using your favorite file-management tool, go into your project directory and delete the .gradle/
and .idea/
directories and the file ending in .iml
.
Step #6: Using your favorite file-management tool, go into your app/
module directory and delete the file ending in .iml
.
Step #7: Back in the "welcome dialog", choose "Import project (Eclipse ADT, Gradle, etc.)", browse to your project's root directory, and import it.