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 ideal from eclipse to android studio. thanks in advance!

+6
source share
3 answers

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 the source code on Android. but there is a way to transfer this file to the intellij import file. Sorry, I also don’t know how to convey. but my colleague sends me an * .iml file.yeah file, this is a file that can help you hide the intellij module. After you receive the file, copy this * .iml file to the root of the source code, then you can open intellij, create an empty project, import the module from an existing module, and then select the * .iml file in the window after which the only thing you can do it wait. it takes a long time to import it. so you can develop android source code in intellij. enjoy it!

+3
source

I know that this has already been answered, but I wanted to add it to everyone who sees it.

For Android Studio:

  • An open terminal (* nix system) calls the following:

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

  • In Android Studio, select "Open Project" and select the generated android.ipr file.
  • Note. It takes a long time to index all files (~ 2 hours). Be patient. If a dialog box appears saying “Frame Detected”, select it and click “OK.”

You now have the entire Android platform loaded in Android Studio.

+10
source

Follow the steps to switch to Android Studio:

Export from Eclipse

  • In Eclipse, choose File> Export.
  • In the window that appears, open Android and select "Create" Gradle build files.
  • Select the project you want to export for Android Studio, and click Finish.

Import to Android Studio

  • In Android Studio, close all projects that are currently open. You should see the Welcome to Android window.
  • Click Import Project.
  • Find the project that you exported from Eclipse, expand it, select the build.gradle file, and click OK.
  • In the next dialog box, leave the Use Gradle Wrapper on and click OK. (You do not need to specify the Gradle house.)

That is all you have to do. You can refer to the official document in more detail.

+2
source

Source: https://habr.com/ru/post/971655/


All Articles