2

As advised by many, I am trying to make the switch from eclipse to Android Studio. Following the advise in https://developer.android.com/sdk/installing/migrate.html I imported the eclipse workspace directly without generating the gradle files from Eclipse. However after importing, none of my projects have a build.gradle file where I can add a classpath and stuff.

Please advise, is there a way to generate the build.gradle file or something?

Thank you.

AndroidP
  • 751
  • 1
  • 10
  • 19
  • When you import project - there is wrote that you can import eclipse project, build.gradle or setting.gradle. So just import your project to Android Studio File -> import project – Konrad Krakowiak Jan 13 '15 at 18:48
  • At the "Import Project" screen. I can either "Create project from existing sources" or "Import project from external model". Is this what you're talking about? – AndroidP Jan 13 '15 at 18:55
  • Do you have created some project? Or do you use wizard? – Konrad Krakowiak Jan 13 '15 at 18:56
  • Wizard. I used "Import Non-Android Studio project". – AndroidP Jan 13 '15 at 18:58
  • On the first screen you can see option Import Non-Android Studio Project. When you choose this option you will see window with file chooser, Find your project and choose it. I checked on 1.0.2 Build version of Android Studio – Konrad Krakowiak Jan 13 '15 at 18:59
  • Yes, that's what I did. I followed through the process and the eventual project did not contain any build.gradle files. – AndroidP Jan 13 '15 at 19:00
  • Ok as next you can chose create project from existing source and you can select on of gradle or mave. You have to chose gradle – Konrad Krakowiak Jan 13 '15 at 19:04
  • and next you have to fill forms with information about project. – Konrad Krakowiak Jan 13 '15 at 19:04
  • After creating project from existing source, there's no option to select on gradle or maven. The next window specifies the "Project name" and "Project location". – AndroidP Jan 13 '15 at 19:07
  • After "Creating project from existing source". The following windows are: 1. Specify "Project name" and "Project location" 2. Source files for your project have been found. Please choose directories... 3. Please review libraries found... 4. Please review suggested module structure... 5. Please select project SDK... 6. Several frameworks are detected in the project... (Finish) – AndroidP Jan 13 '15 at 19:09
  • This is the second window http://www.artit-k.com/wp-content/uploads/2013/05/Android-Eclipse-to-Android-Studio-7.png – Konrad Krakowiak Jan 13 '15 at 19:12
  • Did you attached SDK to android studio? The path which you described is correct. It is all what you have to do. – Konrad Krakowiak Jan 13 '15 at 19:13
  • I tried both. Attaching android sdk or java sdk. Neither produces build.gradle. – AndroidP Jan 13 '15 at 19:18
  • Both show this message "Migrate Project to Gradle? This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system." – AndroidP Jan 13 '15 at 19:19
  • I migrated some eclipse project a few time but I never had a problem like you. I think that there is some little issue. – Konrad Krakowiak Jan 13 '15 at 19:20

2 Answers2

2

Have you read this? Looks like you didn't get the special import wizard flow. At least for me this was the case.

The root directory of the project you import must have an AndroidManifest.xml file.
Either:
    The root directory must contain the .project and .classpath files from Eclipse
or
    The root directoy must contain res and src directories.
Community
  • 1
  • 1
m02ph3u5
  • 3,022
  • 7
  • 38
  • 51
1

I had the same issue. My project referenced several library projects, which lived in nested folders within the main project folder. After flattening the folder structure (i.e. putting the library projects in the same folder as the main project), the Gradle files were generated. However, I got a more simple import workflow with only some check boxes to set. I'm using Android Studio 1.2.1.

jbxbergdev
  • 860
  • 1
  • 10
  • 23