Borys
Borys

Reputation: 1823

Import project in Android Studio from Eclipse

I installed new Android Studio 0.1.1 based on IDEA ide and tried Import code from Eclipse.

  1. Go to Eclipse->Export->Grandle so it add gradle file
  2. Open Android Studio and select Import Project and select my project folder with build.gradle file
  3. Press Finish and get an Error: failed to find target android-15 (this is was parget of my project) enter image description here
  4. I go to system variables and change to %ANDROID_HOME% = d:\dev\android\android-studio\sdk\ (remove platform-tools from path)
  5. And get new error: failed to find Build Tools revision 15.0.0 enter image description here
  6. Also create another New Project and change Android SDK for it, but I still cant import project

I explore this problem and find the weak point: in file build.gradle I change next lines:

And it fix my problem with project import. I think it's problem in Eclipse export function. Build tools starts only from version 17 (in ADT 22), so it's imposible to find version 15.

Upvotes: 30

Views: 34634

Answers (11)

Sreejith tk
Sreejith tk

Reputation: 76

In the file build.gradle change your compileSdkVersion to your current version. For me it is 23. Your buildToolsVersion would be the same number. Hence the only thing I had to do was

  • Change CompileSdkVersion 15 to CompileSdkVersion 23 in the build.gradle

Upvotes: 0

Muhammad
Muhammad

Reputation: 89

I simply solved the problem by changing the project build target (Project properties->Android->Project Build Target).

Upvotes: 0

qix
qix

Reputation: 7952

Had the same problem when Android studio 0.2.9 on mac and importing an old eclipse project:

By default, it uses /Applications/Android Studio.app/sdk as the android sdk location, instead of whatever you used to use.

On a per-project basis, you can go to the menu's File->Project Structure (command-;) and on the left you can change the project's sdk location.

To handle all projects (new or imported), before opening anything at the start screen click configure -> Project Defaults -> Project Structure -> (on the left) Android SDK to do the same. (re: https://stackoverflow.com/a/18409923/954643)

If you were starting from scratch without any android sdk setup and eclipse though, you'd have to download the missing SDKs via Tools->Android->SDK Manager.

Upvotes: 0

David
David

Reputation: 2346

For general 'import project' info, search for the word 'import' on this install-guide document for Android Studio:

http://developer.android.com/sdk/installing/studio.html

EDIT: I've recently learned to use the 'import' dialog, so that I can import projects from GitHub, which is very cool! (I first watched a tutorial on YouTube titled 'git and github'). Then I learned that one needs to use 'git' to "Clone" an entire GitHub repository (to bring a dir-tree full of separate projects to your development machine). Then, you can navigate into that sub-tree, to a given project of interest, and then use Android Studio's 'import' dialog to play with that example project.
WOW, NEAT!

Hope this helps...

Upvotes: 0

Yassin
Yassin

Reputation: 1386

These simple steps worked for me:

  1. Open new project (new not import)
  2. Press F4
  3. On the left Click on SDKs
  4. Delete all SDKs
  5. Click on +
  6. Choose the SDK you are using for eclipse
  7. Choose the right version
  8. Click OK
  9. Open your project using gradle file

enter image description here Enjoy :)

Upvotes: 2

inigoD
inigoD

Reputation: 1741

Had same problem, now works. I did this:

Open android studio:

Tools -> android -> SDK manager then install the android 4.0.3 (API 15) and done.

It worked for me.

Upvotes: 10

JosephN
JosephN

Reputation: 404

From the quick start window, choose Configure, then choose Project Defaults, and then choose Project Structure. Then on the left under Platform Settings choose SDKs. Then to the right of that choose the current android platform, mine was Android 4.2.2 Platform, and delete it using the red minus button at the top, then add a new android platform using the green plus button at the top and point it to your current SDK folder and that is it.

Upvotes: -1

Metalhead1247
Metalhead1247

Reputation: 1978

Update your android APIs using Android SDK Manager.It seems you have installed API lower than level 15.

Upvotes: 0

user2370642
user2370642

Reputation: 119

Update SDK go to config settings, project settings then you will see SDK that isn't correct point to same place eclipse points to for SDK. Worked for me.

Also it might help to reexport the project with new sdk

Upvotes: 0

JoeHz
JoeHz

Reputation: 2196

This is an import problem. NOT an SDK Level issue.

You need version 22 of the SDK Manager before you attempt the export or it won't be in a format that Android Studio can consume.

Upvotes: 1

loose11
loose11

Reputation: 627

Do you have updated SDK for Eclipse? You need the Rev.22. After you downloaded it, you can Export the Project with a "build.gradle".

Migration of the Projects

Updating your SDK

Upvotes: 0

Related Questions