How to download Source code from Android Google Source With Gradle files - android

How to download the android project from android.googlesourece.com with the Gradle file!! I want to download the DeskClock app
https://android.googlesource.com/platform/packages/apps/DeskClock/+/refs/tags/android-r-preview-2
but the project does not contain the Gradle file, also I did go through the official documentation but I don't really understand well. is there a tutorial guys, can you guys guide me how to get the files with Gradle

These apps are part of AOSP build tree. There are no Gradle files for them. The information on how it is build, what its dependencies are is inside Android.mk (or Android.bp for newer versions) .
To build a such app, you'll have to download the whole AOSP tree, setup the environment, and then you can build a single module using mmm packages/apps/DeskClock.
You could always try to import it in Android Studio, and see if that works.
Apps in the AOSP tree often use non standard SDKs ( methods and classes that aren't part of official SDK that you get when developing Android apps).
It's generally difficult to build them out-of-tree like this. This might be of help for some references https://github.com/anggrayudi/android-hidden-api.

Related

How do I use Clojure in Android Studio using Graclj?

My ultimate goal is to be able to write Clojure apps for Android, using Android Studio and Cursive. I started with leiningen but found out that it is a build system that is independent of what Andoid Studio uses ie Gradle. So I tried leiningen with Intellij, but couldn't get Android deploys to work except from the command line. Since I wanted to integrate with Android Studio, I decided to try Graclj: https://github.com/graclj/graclj which is a Gradle plugin for Clojure.
I can get the Graclj tutorial running in Android Studio, as per this guide:
https://github.com/graclj/learning-graclj/tree/learning-0.1.0
However:
Graclj expects the Clojure src and built classes and jars to be in the root project
Android Studio expects src and classes to be in the app subproject
After the tutorial I end up with separate Gradle build tasks for Graclj and Android Studio but I don't know how to integrate them
So, can anyone suggest a way that I can hook into Andoid Studio's build process?
Do I need to change some settings to the Graclj plugin to do this? If so, how?
Do I need to change some Android Studio plugin settings?
Do I need to add/change something in the Gradle build scripts?
Am I heading down a dead end? ;-)
I have looked at the Android Studio build process: http://developer.android.com/tools/building/configuring-gradle.html
but I don't know enough about Gradle to know what I'm supposed to be doing here.
If I need to supply any more info, just ask.
Any help appreciated!
Unfortuantely, I don't have any Android (let alone Android Studio) experience. However, I'll do my best to answer based on Gradle/Graclj knowledge.
Graclj does not require you to use the root project. You can apply the plugin(s) in any of the projects that you have in your build. However, I don't know how well a model-based plugin like Graclj will work with the "traditional" Android plugin. You could try the "experimental" one that's using the model approach, though there's a decent chance that it won't be compatible unless there's one that works with Gradle 2.12.
Alternatively, you might be able to add a dependency to the Android app project on the JAR produced by Graclj (which you may still want to put in a project besides the root). Not sure if there's a very good way to do this (haven't tried myself).
dependencies {
// my-other-proj being whichever one you use Graclj in
compile project(':my-other-proj')
}
Or maybe you would need to add it to a configuration first in the my-other-proj to interop with traditional plugins:
artifacts {
archives createMainJar
}
It is possible that you're at a dead end (for now). Graclj is very new, so this stuff should all be possible eventually.

How to create a SDK on Android?

I developed an Android app with Android Studio and I want now to create a SDK to enable other developer to use the technology I created. This SDK should use an activity and a couple of background service.
I've looked around on internet and on SO, but I did not manage to find the basic information I need :
How to set Android Studio to build a SDK , not an APK;
Is there any security to implement so that my code is not readable by others?
I created an app but I have no basic knowledge on building SDK, so any information or link where I can learn would be appreciated.
According to me what you require is a .aar file. Just like you give out Java sdk's as a jar, you can package your Android code as a .aar file. This can be imported in any other Android project and your exposed API's / screens can be used directly.
To create an aar select your module in Android studio project structure- then on the right pane select gradle and then select generate .aar file. This will be generated in your build/outputs folder.
Now this can be added in any project and compiled by putting a dependency in the gradle. You can Google "creating an aar" for more information.

Google launcher building

I tried to build this project using JetBrains IntelliJ IDEA but it was unsuccessful (there were a lot of errors). The project has an Android.mk file, but I didn't see the C++ code.... How can I build this project? I've tried to use another IDE, then I tried building from the console but it was not useful. Perhaps, does Launcher3 need NDK to build it?
You'll need to isolate the launcher's code and then identify all of it's dependencies. If the code has any C++ code then it definitely requires the NDK and currently IntelliJ/Android Studio does not have any stable support for NDK based app development (though it is a work in progress) else if it is pure Java (most probably) then you'll have to manually add the classes and build the app from Android Studio! Either way you will have to dig deeper into the source and know for yourself. Unfortunately there seems to be no easier option, for now. I wouldn't mind being proved wrong for the matter.
EDIT :
I glanced through the code and I noticed there are no C++ source files or library (*.so) files. This isn't a gradle project and hence cannot be built as one. You'll need to setup a gradle based Android project and then begin adding the sources (src, tests etc.) and their dependencies (res etc.). You can start of here : Getting Started with Android development if you're new, else you can move to this : Gradle and Android

Can I use Android Studio when teammates uses Eclipse ADT?

Just a quick question I did not find a good answer on. We are currently working on an APP created with Eclipse ADT Bundle. I recently started exploring Android Studio, and like it. Is it possible to still collaborate with my mates using Eclipse with a shared GitHub repo?
I noticed Android Studio converts the project to its own file structure, so I guess this does not go well with Eclipse, and the repo.
Is there any solutions for this? So I can keep developing in Android Studio, push to GitHub, while the rest of the team use Eclipse?
I think you can do it, you'll just have to explicitly define a sourceSet that matches the Eclipse structure. If you use any other build variants, they can't have any sourceSets because you wouldn't be able to check those files in to source control. However, there are several useful things you can do with build variants just with the build file. I think you can check in the build.gradle and other gradle stuff and it won't mess up your coworkers.

Android AOSP project import into eclipse

So, this is not like other problems. I have basically one question
Android project build system uses the Android.mk files.
Is there any eclipse plugin out there that parses through the mk files and allows me to load those projects into eclipse ? essentially import Android.mk file project...
You can import the whole Android sources into eclipse. The instructions are here. Then you should make some modifications (for instance, include android-common_intermediates/javalib.jar instead of google-common_intermediates/javalib.jar) and you will have possibility to develop in eclipse.
Eclipse separates Android sources to several projects by itself(I think according to classpath entries). If you want to change this behavior you should look in this direction.
If you have tried eclipse instructions at Android source site, you probably would know by now that it leaves lot of details to imagination.
One thing you need to keep in mind is that AOSP build doesn't work with eclipse. As long as you build your code from terminal and use eclipse to edit/browse/debug purposes, you will have more productive sessions.
The article at Using Eclipse to browse/edit Android platform code explains this in step by step.

Categories

Resources