Making multiple apps in android studio share source code - android

I've been asked to white label an application I am making which has resulted in me needed a project with the exact same code base, but a different manifest and different resources files. Is there currently a way to do that supported by android studio? Or is the only way to try to do it with multiple full projects and updating both?

Related

how to create apk from java source code?

I am a newbie in Android programming language and I have a question. I would really appreciate if someone guides me in this regard.
I have java source code of an Android project (no entire project). Can I build the application without other required files such as xml file for layout and ....
Regards,
H
First of, an android application is just an "archive" that contains a specific architecture.
As you pointed out, it is composed of a Manifest (xml) file defining the different parts of your application: Activities, Services, Permissions, etc.
There is also the resources files such as layouts, pictures and files used by the application.
Finally, there is the source code.
I recommend you take a look at online tutorials which are well detailed over the Internet, and to take a look at the Android SDK samples.
To develop Android applications, I recommend that you download the Android ADT bundle (containing both Android SDK and Eclipse IDE including Android projects management).

Is it possible to add a externally-maintained project library, without copying?

I'm working with Android Studio 0.5.8.
I have a Working project, and I want to reuse all its contents to make an almost identical app with only another name and different colors.
Basically I want to make a library from the original app and reuse it in various identical apps, but I don't want to copy & paste inside each new app, I want to maintain and develop only one codebase (the project library).
I have read and read, but I can'tt find any real solution.
I tried this in my settings.gradle:
include ':AppCopy1', ':..:LibraryProject'
It works, but I cant use any classes in AppCopy1.
This sounds like a good candidate for Product Flavors. The Gradle build system has support for maintaining a single codebase and building multiple apps from that codebase that only differ by a few files changes. See the configuration examples here: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants for details.

Android Multiple project with Same Codebase

I have multiple android app running on same code base but the project resource and API are different. I have read the following question How to create multiple Android apps from one code base and my problem is that how to manage the project resource like images,color,text which was entirely different in each app.
Resources in app projects override ones with the same name in library projects. So you just add the images, etc. to your app project and it works out more or less automatically.

Android: Managing projects in Eclipse

I developed pretty large Paid app for Android. It has many sections and plenty of images and videos. Now, I want to create a LITE version which will have only few section available (with some disabled functions and changed UI) and only some images and videos (80% less resources than the Paid version).
My question to you guys is what would be the best way to handle this problem. Obviously, I can just copy the project and remove unnecessary sections,resources, etc. However, it will make the project hard to maintain (for every bug I would have to fix two project independently). I know that in XCode for iPhone you can set targets and specify which resources can be disabled. Is there anything similar in Eclips?
Thanks
I was playing around with this earlier, because I also had a paid/free combination on a couple of apps and the manual process seemed too tedious.
I created a workspace with three projects
1. A library project with all the common code and resources
2. Free version
3. Paid version
All you have to do in the actual installable projects is register the activities. They can live in the common library project, but you just have to register them with fully qualified names in your app projects' manifests (same goes with a custom application class if you use one).
You can use the PackageManager to determine the fully qualified name of the running app and turn functionality on or off.

Same project but customised and installable alongside each other?

I have a small Android project that I use as a core project. From this core project I want to be able to do customisations.
So I have the app in a framework format using standard icons, buttons etc... I want to be able to create different versions with different icons and buttons.
This I know how to do. (I will have two separate apk files, both with the same code but with different resources)
However I want to be able to install the core project and a customisation on the same device at the same time. Currently one will overwrite the other.
I have tried to change the package in the manifest but this in turn means I would have to also change all the imports for R.java in my Java files, this is something I want to avoid.
Is it possible to change just something in xml that will allow me to have two projects using the same Java files but with different resources?
You should use Android Libraries.
Put all your application code into one Android Library and then create two Android Applications which have custom icons and different package names. The resources defined in final Android Applications will override all already existing resources in Android Library.
One drawback: you'll need to have to almost identical copies of AndroidManifest.xml files in your Android Application (but they still should have different package names).
For more info:
Android's documentation: Settings up Android Library project
My post: Android Application, Android Libraries and Jar Libraries. This one describes how Android Libraries work.
You should create a library project that contains all of your source code, and create a project for each of your installable packages that references the library project. You can then define/override any resource definitions in the installable projects

Categories

Resources