How to load same android app to device with different name - android

Our company has developed a android app for our customer. I want to create a new app with different name with same source code. I have already changed the app name. But when ever I load this new app to my device from android studio it gives error saying "alredy a new version of app is running in your device".
I want to release the same app with different name to the app store.

If you use android studio, use flavors to compile your app using different packages and different names
Have a look on this website : http://tools.android.com/tech-docs/new-build-system/build-system-concepts

change package name of application in manifest also change app name.

An addition to the other answers here is an example for how to do this:
android {
defaultConfig {
// your config
applicationId "com.packagename.appname"
}
productFlavors {
release {
// you config
applicationIdSuffix "release"
}
debug {
// you config
applicationIdSuffix "debug"
}
}
}
for more, feel free to read this manual

Related

How to upload 2 different flavor apps in 1 playstore project

Following is my app package name
com.test.myapp
and I have created 2 product flavors, 1 for development & 1 for production like following.
productFlavors {
dev {
applicationId = "com.test.myapp.dev"
}
production {
applicationId = "com.test.myapp"
}
}
It works fine, when i launch app from android studio, it also creates signed apk fine, but when i try to upload development apk on play store, it gives following error message.
Your APK or Android App Bundle needs to have the package name
com.test.myapp.
Technically it is not possible, Google not allows this, you need to create 2 apps on Google play for this. But why you need flavor for development with different package name? does Google's Alpha testing not solve your problems?
Edit:
Based on comments the issue was how to load different strings.xml based on build config without creating new package name.
Solution:
flavorDimensions "dev"
productFlavors {
dev {
flavorDimensions "dev"
}
prod {
flavorDimensions "dev"
}
}
Create new strings.xml resource in dev source set
\src\dev\res\values\strings.xml
I have uploaded demo project:
https://github.com/pavelpoley/FlavorTest
More info you can find in docs:
https://developer.android.com/studio/build/build-variants#sourcesets

Can an app have multiple google-services.json files?

I have an android sdk which requires the app using it to have google-services.json file in its project directory.
I am wondering what will happen if the app already has a google-services.jsonfile from its implementation and is receiving FCMs from its own google developers console.
Can an app have multiple google-services.json file for the same flavor.
Can an app receive FCM's from two different google developers console account? or How can an app receive FCM's from two different google developers console?
I am just trying to explore ways as to how I can send FCM from my server to the app without making the app change its underlying design.
Downvoting must be accompanied with reason.
If you have multiple flavors configured in your app is intende to say that you will create multiple apps with different package name, for example:
flavorDimensions "mysite"
productFlavors {
elnorte {
applicationId 'com.jorgesys.creatorhdplayer'
manifestPlaceholders = [appName: "Creator hd player"]
dimension "mysite"
}
reforma {
applicationId 'com.jorgesys.creatorhdfree'
manifestPlaceholders = [appName: "Creator hd free"]
dimension "mysite"
}
mural {
applicationId 'com.jorgesys.creatorhd'
manifestPlaceholders = [appName: "Creator hd"]
dimension "mysite"
}
}
therefore you need to add diferent google-services.json files in your proyect for every application that needs google play services :
The google-services.json file is related to the package name so you just need one file for every application. The same if you have only one flavor configured (one application)

how to run same android app with different name in one device?

I build a two apk from same source code . both have Different name,icon background .i changed only UI and app name tow app have same package,
my problem is I can't install this both app on same device .when I try to install facing error message .
How I can run this two application (build from same source just change name and icon) on same device .? what are the values I should change in application to run this app separately .?
Kindly Give me a hand with this
You need to change package name to make Android System detect your 2nd app as different from first. App name doesn't matter.
Use productFlavors in your build.gradle file.
android {
productFlavors {
dev {
applicationId "com.company.app.dev" // package name for dev flavor
}
beta {
applicationId "com.company.app.beta" // package name for beta
}
production {
applicationId "com.company.app" // package name for production
}
}
}
All your files can still be in your src/main dir. Flavor specific changes can be placed in src/beta etc.
you just have to change the name and the package name of your second instance of the application.

Android : Install different flavors with same package names

I developed an android app with 3 different flavors (production,testing, training). Almost 99% of the source codes are identical. Only a single file in assert folder with server urls are different for each flavor. The flavors work perfectly. But i would like the app to install all 3 apps in the device without overwriting each other. Since the package name of the project is the same for all the flavors, it's overwriting the app when i install difference flavors.
Any ideas or suggestions ? Thanks in advance.
Anyway just by changing the package name in the build.gradle it works.
productFlavors {
production {
applicationId = "<your-package-surfix>.production"
}
testing {
applicationId = "<your-package-surfix>.testing"
}
training {
applicationId = "<your-package-surfix>.training"
}
}
In AndroidManifest.xml use full package name when define a activity/service/receiver.

Install "dev" build of Android app along side market version

I just released my first Android Application through the market. I'm currently working on some new features for the next release and would like to install this "dev build" on my phone, without uninstalling the "production" version (among other things, this will stop future updates from the Market).
I'm especially interested in this because I'd like to give the APK to friends / "beta-testers" to try, but I don't want them to uninstall the released application first.
Is there anyway to have on one device two applications: "App (via market)" and "App (DEV)"
Would this involve using a different signing key or modifying the manifest in someway?
Thanks!
You can simply rename the package, so both apps are installed.
You need to change the package name in the manifest as well as in the source folder. Use Eclipse's refactoring for it and it will be done in a minute.
They don't need to be signed with the same key.
Using Gradle this is very easy. Here's an excerpt from one of my gradle files:
android {
// ...
defaultConfig {
resValue "string", "app_name", "<app name>"
// ...
}
buildTypes {
release {
// ...
}
debug {
resValue "string", "app_name", "<app name> (debug)"
applicationIdSuffix ".debug"
// ...
}
}
}
The key part for allowing another installation is using the applicationIdSuffix that is set in the debug build. Under the hood this basically does the same thing as proposed in Force's answer; it changes the application id of your app.
Setting the resValue app_name allows us to have different app names as well, this makes it much easier to keep track of which installation is which (since both application would get the same name otherwise).
Don't forget to remove the app_name from your strings.xml and fill in your own app name instead of <app name> if you decide to set the app_name in the gradle file like I did above.

Categories

Resources