Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import android source code(AOSP) into Android studio?

I know how to import android source code into eclipse, but is there any way to import android source code into android studio. Because I want to change my IDE from eclipse to android studio.

like image 689
cowboi-peng Avatar asked Jul 02 '14 12:07

cowboi-peng


3 Answers

I know this was already answered, but I wanted to add onto this for anyone else that sees this.

For Android studio:

  1. Open terminal (*nix system) call the following:

    {AOSP root}/make idegen && development/tools/idegen/idegen.sh
    
  2. This will generate an android.ipr file in the {AOSP root} directory.

  3. In Android Studio, select 'Open project' and select the generated android.ipr file.
  4. Note: this will take a long time to index all the files (~2 hours). Be patient. If a dialog box that says 'Framework detected' appears, select that and hit 'OK'.

Now you have the entire Android framework loaded into Android Studio.

like image 161
wseme Avatar answered Oct 23 '22 08:10

wseme


I found the answer from my colleague, he told me that , use the file in

sourcecode/development/ide/eclipse/.classpath 

this file is for eclipse to import android source code . but there is a way to transfer this file into a intellij project import file . sorry , I also don't know how to transfer. but my colleague email me a *.iml file.yeah ,this is the file that can help you crate the intellij module . After you get the file ,copy that *.iml file to the root of your sourcecode,then you can open the intellij,create a empty project ,import module from existing module ,then in the window ,chose the *.iml file ,after that ,the only thing you can do is wait . it takes much time to import it. so ,you can develop the android source code in intellij . enjoy it!

like image 39
cowboi-peng Avatar answered Oct 23 '22 07:10

cowboi-peng


Follow the steps to Migrate to Android Studio:

Export from Eclipse

  1. In Eclipse, select File > Export.
  2. In the window that appears, open Android and select Generate Gradle build files.
  3. Select the project you want to export for Android Studio and click Finish.

Import to Android Studio

  1. In Android Studio, close any projects currently open. You should see the Welcome to Android Studio window.
  2. Click Import Project.
  3. Locate the project you exported from Eclipse, expand it, select the build.gradle file and click OK.
  4. In the following dialog, leave Use gradle wrapper selected and click OK. (You do not need to specify the Gradle home.)

That's all you need to do. For more you may refer to official doc.

like image 34
Himanshu Agarwal Avatar answered Oct 23 '22 07:10

Himanshu Agarwal