Load AOSP Application to Android Studio - android

I found a few questions asking how to get the source code from the AOSP running in Android Studio. However, I could not find any explanation on how to import only a single application of the AOSP.
I am trying to do it for the Dialer application which can be found here. However, I had only minor success, I was able to import the code as a project, but didn't manage to set up dependencies and required libraries and all that.
Can anybody tell me if it is possible, and if so, how this is done?
UPDATE:
It seems impossible to achieve this with the code that i found and which was part of the full android distribution of google. But google decided to distribute the Dialer application just like any other application via the playStore. So there should be a possibility to find this code, IF it is also running under the open source project.

You can only open the whole AOSP inside Android Studio.
After you finish building the source do make idegen && development/tools/idegen/idegen.sh inside your root folder and then open the new android.ipr in your root via Android Studio.

AOSP code you are looking is not Android Studio compatible, It's an Eclipse project.

Related

Why don't we have a single file to open an Android Studio Project?

Why don't we have a file similar to the .xcodeproj (for XCode applications) or an .xds (for Sencha Architect Projects) for our Android Studio Project?
I'm pretty sure a good number of you here have experienced the frustration of trying to import a project you see online in order to piece it apart better and learn how it works. I get that we are supposed to Import Android Projects built using Eclipse and Open Android Projects built using Android Studio.
However, why is it that we have to go through File -> Open -> then pick out the directory of the Android Studio app that we want to open? And the thing is, Android Studio doesn't seem to know it's an Android Studio project until it tries to open and build it. In the screenshot I have below, I have the sample Android Studio projects of ARToolKit, but I've only imported two of them.
As you can see, only those I've imported "can be seen as an Android Studio Project" as indicated that they have the Android Studio logo instead of a Folder.
This can be an issue for those just starting to develop in Android Studio on their own and they try and use existing projects (build from Eclipse or Android Studio) and they hit a snag with just trying to import the projects for reference. They might not know that they should import the folder and not the projectname/src subfolder. It adds to the "steep learning curve" that Android Development has if opening/importing projects aren't streamlined to a degree.
To sum up, my question is:
Why don't we have a single file that we can open that would in turn open Android Studio and import and build the project if it isn't built yet?
Android is not iOS. iOS development is only possible in xcode, hence it makes sense they added a shortcut to open it in xcode directly with a .xcodeproj file. Make life easier for iOS developers.
Android development however can be done outside of android studio as well. Eclipse is just one example, there may be other IDE's that support this. This is possible because android has standalone SDKs and tools that third party applications can use. iOS does not.
Imagine you are working on an android project in android studio. Then your boss tells you someone from 3000km away is going to help you. This guy may be using android studio, but maybe he isn't. When there are multiple options that developers can choose from individually, you do not want to pollute version control with files that you are using, but others may not care about. Each their environment.
This is merely a logical conclusion that you can come to by comparing. The "real" reason why this was done can only be answered by the people that created (adapted intellij) android studio.
This has been very frustrating to me too.
I try to give you a "beta" answer, waiting somebody to confirm it to me.
An Android project is just the composition of many parts that in some cases are concurrent to create the apk file.
It's just like what happens for the whole java projects: you have the main/src/java, the main/src/test, the maver or gradle files, the gradle or maven wrapper, the manifest, the configuration etc.
So you won't have a single project, but a series of folders that can contain many "flavours" or "versions" of the product itself.
The only help it is given to us is the Android studio icon that appears if a folder contains an android project in its subfolders.
I don't know if I have really answered to you, I just have given you my impressions and my thought.

Anyone know how I can run an android sample app?

I'm fairly new to android development using Android Studio. The examples online say to build with Gradle. I choose Gradle when importing the project but then I get an error saying that it is not a Gradle based project. Does anyone know how I can get over this to run it on my phone?
Pick a sample project to import that has build.gradle file in BOTH the app module directory AND the project root directory.
Strongly recommend rather than importing an existing project, you create a new one from scratch yourself, following along with a tutorial.
Here's a really good first tutorial for Android Studio which is recent (August, 2014) as of this question, so it will all be relevant to the current version of Android Studio.
http://www.codeproject.com/Articles/801078/Hello-Android-The-Hello-World-Application
As far as getting the app onto your phone you can either (a) plug in the USB cable from the phone to your PC and run from Android Studio, or (b) email the app's APK file as an attachment to any email address you check on your phone (such as gmail for example). For the email method, you also need to change a security option to allow apps from unknown sources.

Creating a new Android Library in Android Studio

I've been searching the web for half a day now but I just can't figure out how to create a new Android Library with Android Studio.
I've tried doing things like this: How to create a library project in Android Studio and an application project that uses the library project
But when I enter the New Module menu it just says "Nothing to show".
I can't find out why or how to fix it.
Is there a way to manually add a library? If so, how?
I'm trying to add an import method to my app so users can import a preferably rar file or just a folder to be used in the app.
TL;DR: How can I add the option Android Library to my New Module menu inside Android Library?
EDIT: To clarify things; I've made a web app in which u can create your own click/touch-able interface. The projects u make with that app can be exported to a rar file which is basicly a webpage with html, css and javascript that runs the project. I can run that webpage in my android app just fine but I need other users to be able to import the files somehow. So I was thinking about using a file manager so users can import the files into the app. I'm working with this one a.t.m. https://code.google.com/p/afiledialog/ but it needs to be a library.
Updated my Android Studio today and guess what, it's fixed!
So anyone who has this problem just update asap. Tried this on Mac and Windows and it now works on both.
PS: I'm on version 0.2.6 now (version of august 24). Guess I was one day too early with the question :P

Opening android AOSP native applications in eclipse

I need to edit the original Android Apps from packages
in terms make my own distro/mod..
I want to make changes to the In Call screen, lock screen, contacts, calendar etc..
I understand that for doing this I will have to build everything from
source,
however I need to edit the source and to do so I need to open the OS provided apps as
eclipse projects,
When I did I saw that there are
missing imports which are hidden in the SDK (or missing)
hidden parameters within the classes..
I don't want to use reflection since the whole code is here and
available, but how do you build a platform development kit..
or PDK ?:)
Can any one help?
You start by reading the documentation.
EDIT:
If you are trying to download some single project from AOSP and compile it using the SDK, odds are very strong that it will not work, and that you will encounter problems like the ones you cite. You do not build Android by building individual apps; you build Android ("my own distro/mod") by building the entire firmware. Most AOSP applications are not designed to be compiled by the SDK, but need the whole firmware.
Please check Using eclipse to browse and edit AOSP. You can atleast edit your code using eclipse, but you will have to use AOSP build system to build your distro.
You might also check Debugging Android Java Framework services as that would help debug your changes.
Just open Eclipse,
then go to "window" +"preferences" +"android"
there you will get sdk location,then give the appropriate path of the android sdk for proper run...

How to load com.android.music code into Eclipse and compile?

I did a git on the com.android.music app and then created a project in eclipse from existing code. I chose 2.1 as the sdk target but I am getting errors trying to compile.
Is the music app referencing code that is not part of the 2.1 sdk? Can someone list the steps for how to compile in eclipse?
Description Resource Path Location Type
ArrayListCursor cannot be resolved to a type PlaylistBrowserActivity.java Music/src/com/android/music line 529 Java Problem
MediaFile cannot be resolved AlbumBrowserActivity.java
Is the music app referencing code that
is not part of the 2.1 sdk?
Absolutely. Most of the built-in apps for Android were created before there was an SDK. You will not be able to build them in isolation from the rest of the firmware without substantial work. Work which, BTW, would be welcome contributions back to the Android open source project, if you were so inclined... :-)
Check the applications manifest file. It will contain an attribute stating which version of the SDK the application was built with.

Categories

Resources