I want to create several different apps/projects that all use a common code base, as well as the same activities and views. The unique things between each project would be:
App name
Bundle identifier
Icon
Version
Analytics ID
Web service URL
Various images and colors
I believe this would involve creating a library project that contains the common code between projects, and then creating each project with the unique items above that reference the library project. Is this the approach I should be taking? Am I able to create all the views/activities in the library project and have the other projects use these?
Thanks!
Related
I created a project, that is a finished product. Now I have different user, for them I have to change somethings such as app colors, name, service URL.
Now I made my project as a library and for different user I created different modules. And these modules are adding my project as libray.
Now my questions are
How to update my service url per client. Such as client url that is used in library project exist inside Common file. How to change/Override this?
How to change colors, and other resources?
What is a best way of creating library that allows to override its properties? And how to do that?
I know there is a complete link on android page to how to create a library. I have done that. But I really not getting how to override properties of library. How to give them a way to get updated by modules that are using them.
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.
I have two Android apps with different icon and color themes but that share the same activities, layout and logic. Any idea how to manage these apps? It would be counter-productive to duplicate the logic and layouts. There should be only one instance of layout, logic, etc.
this is the perfect scenario for using an Android library project.
Use your project as library (check the properties) and let the two implementing projects use that library.
You can re-use code and resources like layouts, images etc. across multiple applications using a library project, linked to from your different customised projects.
In Android Studio, you can harness the power of the gradle build system and easily create a solution for your problem. Check out http://tulipemoutarde.be/2013/10/06/gradle-build-variants-for-your-android-project.html
I'm currently in the process of creating quite a large scale Android application. As part of the application I've created a Custom View (one of many).
The Custom View in question is quite wide ranging in terms of functionality and because of that there are an awful lot of layouts, resources & drawable involved to respond to different devices, orientations, resolutions etc.
How can I separate out this functionality so it can be developed in isolation and not contaminate resources in the rest of the project. (Also, make it available to share across projects without having to untangle resource's).
I'm hoping that it is possible to somehow "jar" it all up in some way but fear this may not be possible. It would be great if anyone has any strategies to achieve this.
You'll probably want to look at a Library Project.
It lets you share code and resources between applications.
From here:
An Android library project is a development project that holds shared Android source code and resources.
Other Android application projects can reference the library project and, at build time, include its compiled sources in their .apk files. Multiple application projects can reference the same library project and any single application project can reference multiple library projects.
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