30

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:

  • from compileSdkVersion 15 to compileSdkVersion "17"
  • from buildToolsVersion "15" to buildToolsVersion "17"

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.

burseaner
  • 885
  • 2
  • 17
  • 28
Borys
  • 1,793
  • 2
  • 17
  • 32
  • Had the exact same problem, the same things fixed it for me except that i had to install the sdk 15 in the intellij folder aswell. There's a new android-sdk folder there. It would seem that it doesn't use the old one. – lfxgroove May 17 '13 at 10:01
  • In [Migrating from Eclipse guide](http://developer.android.com/sdk/installing/migrate.html) google recomend to use gradle, so I get this problem. – Borys May 18 '13 at 08:51
  • I just ran into this problem when switching to intellij and Borys' suggested change the buildToolsVersion in build.gradle fixed it for me. Thanks. – anthonycr Jun 08 '13 at 17:08
  • This is something that we will fix soon in Android Studio. Studio should automatically install any missing platform. The underlying infrastructure was adding recently, and now we have to hook it up to Studio. – Alex Ruiz Jun 21 '13 at 14:12
  • 1
    FWIW, in my version 0.2 of Android Studio, the value of 'compileSdkVersion' is only accepted as a numerical, but not a string value (i.e., no quotes). – richey Aug 03 '13 at 23:36

11 Answers11

10

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.

inigoD
  • 1,681
  • 14
  • 26
2

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 :)

Yassin
  • 1,376
  • 18
  • 18
  • 1
    It fixed only first problem with "failed to find target android-15", but second one is a bug off gradle export plagin in Eclipse. As Alex Ruiz said (Jun 21 at 14:12) in comment, they will fix it soon. Any way thanks for your attention to this problem. – Borys Jun 27 '13 at 06:35
1

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.

JoeHz
  • 2,136
  • 1
  • 18
  • 29
  • 2
    I have ADT 22 and my Eclipse run on it. And I did export to gradle with ADT but got an error. – Borys May 29 '13 at 19:21
0

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

loose11
  • 607
  • 6
  • 31
  • 3
    Yes, but my project was targeted to Android 15. And Eclipce plugin did wrong Export to gradle. There is no Build tools version 15 or less. Google provide only version 17, so I think it's a bug in Export function. – Borys May 17 '13 at 07:09
  • It's not the Android Target Level. Its the version of the SDK Manager Borys is referring to. Version 22 of the SDK Manager is required by Android Studio (and for all I know [it's brand new] that could be a requirement of Eclipse so it makes exports in the right way). The instructions say to have that done before you try to export from Eclipse, so start there at least. – JoeHz May 18 '13 at 23:56
0

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

user2370642
  • 119
  • 2
  • 9
0

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

Metalhead1247
  • 1,978
  • 1
  • 17
  • 28
  • Initialy Android Studio cand find SDK location, but when I fix PATH I find that I have no SDK api 15, so I copy it from eclipse folder. And got second error. – Borys May 20 '13 at 16:23
0

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...

David
  • 2,253
  • 5
  • 23
  • 29
  • Thanks for your answer. But I think you don't read my question at the begining "1. Go to Eclipse->Export->Grandle so it add gradle file". Export from eclipse was first step to reproduce. I think Google fix this bug already. – Borys Jun 29 '13 at 07:13
  • Well, I READ your question, but yes, I doubt that I UNDERSTOOD it, since I know almost nothing about Eclipse IDE. I'm still trying to understand the various notions of 'importing' and 'exporting' a project (e.g. in Android Studio), rather than just creating a project from scratch. – David Aug 04 '13 at 12:36
0

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.

Community
  • 1
  • 1
qix
  • 7,228
  • 1
  • 55
  • 65
0

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

Muhammad
  • 89
  • 1
  • 5
0

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
-1

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.

JosephN
  • 404
  • 3
  • 7
  • My problem happened before import in Android Studio. It's problem in gradle file (buildToolsVersion "14"), but as I understand buildTools was added only in ADT22 and minumum version 17, or I need install all sdk platform before importing in Android Studio. – Borys May 29 '13 at 19:09