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

前端 未结 3 1252
生来不讨喜
生来不讨喜 2021-02-04 13:22

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 an

相关标签:
3条回答
  • 2021-02-04 13:30

    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!

    0 讨论(0)
  • 2021-02-04 13:31

    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.

    0 讨论(0)
  • 2021-02-04 13:52

    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.

    0 讨论(0)
提交回复
热议问题