Import project in Android Studio from Eclipse

纵然是瞬间 提交于 2019-12-12 07:13:13

问题


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)

  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

  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.


回答1:


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.




回答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

Enjoy :)


回答3:


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.




回答4:


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




回答5:


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




回答6:


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




回答7:


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




回答8:


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.




回答9:


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




回答10:


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



回答11:


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.



来源:https://stackoverflow.com/questions/16596794/import-project-in-android-studio-from-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!