Android Studio: Override remote dependency with local checkout for development - android

If an Android app depends on a library that is developed simultaneously in a separate git repository, it would be convenient to develop them in the same project, but keep the proper remote location of this library as dependency.
So during development I would want to use a local checkout of the dependency, which I can constantly develop alongside the app and push updates to its own repo. Yet the app project's configuration should properly refer to the dependency's remote URL.
In Xcode I can do this easily by creating a Workspace, into which I drag the app project, and the local checkout of the package I want to develop in concert. The app project will then use my local checkout instead of pulling the remote dependency.
Is something like this possible with Android Studio, or what is the best way to have a library from a separate git repository (that is used in other projects as well for example) be developed in sync with an app. I want to avoid changing the API in the library, then pushing, only to then find out that the app project doesn't compile anymore with the latest version for example. If the app project already tries with the local checkout of the library, this is a much better development experience.
Is it possible for example to specify the dependency as local with a fallback to the remote? Then I could check out app and library alongside, but on CI or any other developer's build machine, which doesn't have the library checked out, it would pull the dependency and it would work as well.

Related

Can I link source code of library directly as a dependency to an app project

The issue I have is the following (android development):
I have a library that I'm maintaining and an app that uses this library. They are both different android studio projects. In order to use a new version of the library in the app I have to:
Build the library and push it to artifactory
Have the library as a gradle dependency. Update the library version in app's gradle
Rebuild app, install and test library through the app
Since this takes up to 10 minutes every time I want to test something, I was thinking if there is a way to speed up the process. Specifically, is there a way that I can link somehow in the gradle the library dependency directly to the its source code? That way, every time I make a small change in the library, I would only need to build the app (and implicitly the library would be built) and would reflect the library changes immediately.
Of course I am open to any workarounds that can speed up this routine.

Android Studio in an offline isolated environment

I manage an offline, air gapped, dev environment that supports many different types of coding projects. My most frustrating project to maintain is our Android Studio projects.
Our dev environment is isolated with no access to the internet. When I have to bring a new machine up for a user or bring in updates to the Android SDK it usually involves heartburn with getting the building in sync across multiple systems.
Is there well documented processes for building Android apps manually, somehow forcing the Gradle/maven libraries to point to an easily copied and setup place? I'm thinking C make file like build process. When we ran Eclipse it was easy to spin up a new system, just scp someone else's environment. Is there some alternative to mirroring the Google maven environment internally?
Am I over thinking the Android studio build process?
The Gradle build system needs to download your dependencies and store them. after downloading them, as long as there is no change to the dependency gradle will use it's cached version of it on its own.
Now, as long as your dependency tasks remain UP-TO-DATE (the dependency has not changed) you should be fine without a connection.
You could also manually put the jars and aars of your dependencies and use gradle to use them instead -
Just modify the dependencies to compile your libs dir and not get them online (all those compile 'com.google.android.gms:play-services-location:8.3.0' are just url's of sorts pointing to the location of the files) and place the necessary files in libs
Another way of obtaining the files easily would be to run the project once in a connected environment and getting the necessary jars from .gradle/caches/
I have been working in similar conditions. To make development much easier you should setup repository management system. Two popular options are Artifactory and Nexus. In your build tools repository configuration, you should refer to your repository management tool address. With this setup, every computer in the network has to get the source code from version control and good to go.(no extra configuration is required)
In an enviroment with internet connection you can prepare the repository your projects depending and after transfering these files to internal network upload these to your repository management tool.

Compile Email application from AOSP

I would like to add some features to the AOSP Email application which is not supported anymore. So I cloned the repository here (which is a Eclipse project) and migrated it to a Gradle project in Android Studio. But after that it comes to thousend Java errors, missing resources and so on...
So has Google really a not working repo there? Do I maybe need some other repos from AOSP? As it is for now I can't work with it anymore...
So I cloned the repository here (which is a Eclipse project) and migrated it to a Gradle project in Android Studio.
None of the AOSP projects are designed to be used this way. They are designed to be built as part of a firmware build.
If your objective is to contribute changes back to the AOSP, you will need to follow their instructions for using their source code.
If your objective was to create your own email app, you may be better served starting with some base that is buildable as a regular Android app (e.g., K-9 Mail). Otherwise, you are going to need to fix all of those problems, as they reference things that are not going to be available to your app project via the Android SDK.

Continuous integration with jenkins using android studio

I am new here to develop android application with android studio.
I created sample basic application, from this i got the project structure of the application with build.gradle files in each module(which is different from eclipse).
Then I successfully commit the code and push the entire project code to git repository by using Version Control System (VCS) in it.
I need to configure my project with jenkins server for continuous integration.
Can any one give me the step by step procedure, how to configure android studio project code (which is commited in git repository) with jenkins server.
So far i didn't find any clear procedure to configure android studio code with jenkins server for continuous integration.
Thanks in adavance
Unfortunately for you, this isn't a "Tutorial" site. If you have a specific issue, people will help you. But for a tutorial, google around some blogs.
Based on your description, you need to:
Configure some triggers (prolly SCM change, or timer based)
Perform GIT checkout
Perform Gradle build step
Decide where to Archive your artifacts
Do that, and when you have a specific issue, then ask a specific question

Google APIs Client Library for Java (google-api-java-client) -- Maven vs. Importing JARs

I've started work on an Android App that will work with Google Docs.
UPDATE 12/9: From the information I've come across, it seems Google Docs is not supported by this library. The question is probably still relevant in general, but seem not specifically for this project as I can't use the library anyway.
I was doing some research and come across the Google APIs Client Library for Java
I decided to start with the tasks-android-sample to begin learning how to utilize this library.
I followed these instructions
I successfully installed Mercurial and Maven and already had Java 7 installed.
I was able to execute these commands
cd [someDirectory]
hg clone https://code.google.com/p/google-api-java-client.samples/ google-api-java-client-samples
cd google-api-java-client-samples/shared/shared-sample-android
[editor] src/main/java/com/google/api/services/samples/shared/android/ClientCredentials.java
mvn source:jar install
I was also successful in setting up the Mercurial plugin (not sure what this did for me -- I believe the hg command above is the only time Mercurial was involved) and Maven plugin
Finally, I was able to imported the tasks-android-sample, compile it, run it on the emulator and I was able to see the tasks I created on my google account.
I then repeated the process, except this time I simply imported sample's source code and the required JARs into a new Android project and added the ClientCredentials.java manually to the project (So I could specify my Google API Key).
I was also able to compile and run this project and it operated as expected.
My questions in all this is which method is preferred? Or is it a personal choice? Are there benefits to using Maven that I'm not realizing at this time?
Maven helps you download proper dependency libraries for the project, and can reduce the burden of find and download proper libraries.
It's fine to just put dependency libs in your code base. It's a personal choice.

Categories

Resources