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

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.

I know this was already answered, but I wanted to add onto this for anyone else that sees this.
For Android studio:
Open terminal (*nix system) call the following:
{AOSP root}/make idegen && development/tools/idegen/idegen.sh
This will generate an android.ipr file in the {AOSP root} directory.
In Android Studio, select 'Open project' and select the generated android.ipr file.
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.

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!

Follow the steps to Migrate to Android Studio:
Export from Eclipse
In Eclipse, select File > Export.
In the window that appears, open Android and select Generate Gradle build files.
Select the project you want to export for Android Studio and click Finish.
Import to Android Studio
In Android Studio, close any projects currently open. You should see the Welcome to Android Studio window.
Click Import Project.
Locate the project you exported from Eclipse, expand it, select the build.gradle file and click OK.
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.

check this link
http://effie.io/opening-aosp-with-intellij-part-3/
this has all the steps to open AOSP In intellij or Android studio, with some additional steps to fix some errors.

Related

Android Studio : Open Android Module in Android Studio option is missing in flutter project

I am developing a flutter app for both iOS and Android. When generating the APK, I prefer to use Android studio (my default IDE is VSCODE). However, when I go to Tools > Flutter I do not see Open Android Module in Android Studio option. I do see Open iOS Module in Xcode.
I followed couple of SO answers, even tried replacing android.iml file from a working project. Nothing happened. I re-cloned my project from BitBucket because sometimes the Android Studio was fine when the project is freshly from repo, but this time, that didn't work either.
I Also tried opening the gradle file and looking for the option (as explained in one SO answer), that didn't work too.
However I noticed, few issues.
In the folder structure, the root folder is replaced by the flutter icon. in projects where I have no issues with, the folder icon is folder.
In here I see .dart_tool folder. In working apps with no issue, I do not see this folder.
I do not have an android.iml file. In other projects I did.
Below is my folder structure in a nutshell. Whats going on here and how to fix this issue?
When you don't see any options to
open module in android studio
because of missing .iml files caused by .gitignore file, follow simple steps.
Click on File and choose Open..
Now in the opened dialog choose android folder of example flutter project under your plugin module. For e.g if test is your plugin with example as it's app then you need to select and click Ok
test\example\android
3. Then wait for Android Studio to sync and download necessary jar files.
Simplest solution
Open flutter project
Go to android folder
open manfiest file
On the top right you will see option open module in android studio
click on this option
Solution 2:-
Import your android project as a project in android studio
The easiest way is to use this command in the root directory of your project, it will create some missing files and it will definitely work.
flutter create --platforms=android .
Now just right click to Android folder

Missing Files in Android Studio

I have a project which I can open on the computer which I created the project on.
However, when I upload it to Google Drive, download and unzip it onto a different computer, and open the project in Android Studio the only files which are appearing are Java files. See this screenshot:
Also, when I open the project in file explorer, this appears:
Does anyone have any advice on how to solve this?
You need to import the project the correct way.
Go to File->New->Import Project->Select your project
Choose Import from external model and select Gradle. Press Next.
Then make sure to select the correct location or gradle OR gradle wrapper.
Then press Finish.
Hope This works.

How to create an Android Studio project from a subdirectory in a github repo

I need to create an android studio project from this directory on github. I tried VCS -> Checkout from Version Control in Android Studio, but there is no url for this directory in the repo, so I'm not sure hot to clone just this subdirectory.
I also tried downloading the whole repo, doing File -> New -> Import Project in Android Studio, and selecting the messaging subdirectory as the folder to import. This showed a build progress bar, but after it finished, there was no imported project.
How do I do this?
I am not sure if its the correct way, but i resolved it with the following steps on Android Studio 4.1.1 :
Run Android Studio until the Welcome to Android Studio screen shows up.
Select Get from Version Control.
Paste the URL.
Press Clone button.
This will import the complete repository , but you won't be able to run the app yet (exactly as mentioned in your question) .
Now close and re open Android Studio
On welcome screen, select import Project (Gradle, Eclipse ADT, etc.)
Navigate to the folder where the project was downloaded and select the required Sub-folder
Press OK and let the Studio build your project.
I get it now. Go back to this. Then hit Download Zip and unzip it. In Android Studio go to File -> Open -> then to the quickstart-android-master and then down to messaging. Do NOT open quickstart-android-master go down to messaging and open that.
EDIT
Be aware you will have to follow these instructions to get the project to build and run.
Add google-services.json in android studio

How to Create Android app

I created my project in cordova and its here
enter image description here
Here problem is i cant use cordova build function (it isnt work for me)
and now question is here :
can i compile it and make apk file from these files???
if yes how?
i have android studio installed but i dont know how to use it
same as answer by Jackowski.
but,Make sure you import the "platform/android" directory underneath your cordova project (and you want to Import Project, not Open Project).
http://codeofandroid.blogspot.in/2016/02/import-cordova-project-in-android-studio.html
Open Android Studio and select 'Import project' option. Then select your project location and you are ready to use Android Studio with your project.
More info at: https://cordova.apache.org/docs/en/5.0.0/guide/platforms/android/

How do I import/build this project?

I am not a dev, but have some dev experience. I have never used Android Studio before but I wanted to look at an example app. I picked one I am very interested in, but it gives me nothing but grief just trying to import it.
https://github.com/AltBeacon/android-beacon-library-reference
Notes:
I am using the latest version of Android Studio. (1.0.2). I have added in all the SDK files needed I think.
I have downloaded and un-zipped Gradle 2.2.1.
I am running Ubuntu 14.04.
I have dealt with Eclipse for Android previously and was able to
hack someone else's code to suit my needs and actually deploy an unsigned apk.
The readme/install directions at the github don't really help a noob
like me.
Install:
I have extracted the project from the Download Zip link.
For the actual import into Android Studio I choose "Open an Existing
Android Studio Project" - because it looks like one.
I then choose the root directory created by unzipping the zip file,
in this case it is named "android-beacon-library-reference-master".
But it seems to select the project's Gradle subfolder (/gradle) for the project! Which I'm quite certain is invalid. I cannot seem to get it to use the root
folder.
What am I missing? Or is this not the correct way to "import" this particular app? Is this app not compatible with AS 1.0.2?.
TIA!
In Android Studio, close any projects currently open. You should see the Welcome to Android Studio window.
1.Click Import Non-Android Studio project.
2.Locate the project you exported from Github, expand it, select the build.gradle file and click OK.
3.In the following dialog, leave Use gradle wrapper selected and click OK. (You do not need to specify the Gradle home.)
Android Studio properly updates the project structure and creates the appropriate Gradle build file.
Can you try "Import Project" instead "Open Project". Thanks.

Categories

Resources