Multiple Projects with one package name in Android - android

I have a Android Project with an unique Package name. It is also available in Google Play Store. But now I need a huge change over the App. So what do I do to avoid collision in Play store. Also in my local machine do I need to change the Package name because I am using GCM for push notification as well.
Any solution for this or I have to use the old code and change all things .

If you only want to change the package name then you can achieve it by adding more product flavors in your app.
You will need to make the following modifications in your build.gradle
productFlavors {
appWithOldPackageName{
applicationId = "your.existing.package.name"
}
// This specifies the configuration of GHS android for huddle one devices
appWithNewPackageName{
applicationId = "your.new.package.name"
}
}

Related

Android have a full different package name between flavors?

s, i currently have an app that is used with diffrent branding options. Currently they change the package name then build. I want to start an automation process to avoid this.
I want to add flavours to the app so we can have the automation setup for all brands. The issue i have is the current app is published and used.
the package name is already set for each brand since they were renaming it..
like brand one com.brand1 and com.brand2
if i use flavors i need to set a default pakage name like com.myapplication.
that each flavor adds com.myapplication.brand1 or com.myapplication.brand2
is there a way that i can keep the published package name ?So we do not need to have to re upload a new app since the package name is changed and uninstall the old app to re install the new app..
can i specify the entire manifest package name?
productFlavors {
pro {
applicationId = "com.brand1"
}
free {
applicationId = "com.brand2"
}
}

Android app not always created on Fabric after changing applicationId

I have several Android applications for which I need to change the applicationId in build.gradle (or package in the APK AndroidManifest.xml).
After changing the applicationId in build.gradle, the expected behavior is Fabric seeing my application as a new one, since it has a different package name. However my apps don't show up on the Fabric dashboard most of the time, and the new version of my app and new crashes are not displayed for the old package.
So basically, crashes and other statistics aren't recorded on the old app page, and a new app is not created even if I made it crash.
I have also tried making a new flavor to change the applicationIdSuffix, and even changing my source code package. Both worked only once, I couldn't make both of these methods work again.
Here is a sample of the AndroidManifest.xml in my target APK, where ".fabrictest" is added to the applicationId :
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="2006001"
android:versionName="2.6.1"
android:installLocation="1"
android:compileSdkVersion="28"
android:compileSdkVersionCodename="9"
package="com.example.myapp.fabrictest"
platformBuildVersionCode="2006001"
platformBuildVersionName="2.6.1"> ...
I plan to migrate to Firebase Crashlytics soon, but I have to keep using Fabric for now.
My questions :
Is there a reliable way to have an app show up on Fabric, or a way to manually create one on the dashboard ?
Is there a limit to the number of apps/flavors that can be added in a period of time ?
Chintan from Fabric/Firebase here. There is not limit on adding apps. This probably happens because of the fact that package name is used in multiple places in an android project. Try using Edit<find<find in path or Edit<find<replace in path and rename all of those that show up there. In rare cases, your app might need manual activation, in such case reach out to support(at)fabric(dot)io with your app's package name and its Fabric Org name, and they can activate it for you.

Can i publish a new app by using existing app package name

I want to know that can I publish a new android app with existing app package name?
i.e I have a photo editor and its package name is com.myapps.photoeditor. now I want to make new version but i will publish VPN. so the new app will totally different.
VPN will be ok with existing package name com.myapps.photoeditor?
plz guide me
No, you cannot do this. Package name basically I unique ID for an app. When a package name is associated with an app and it is published over google play this is a unique ID for that app. You cannot publish new app with the same package name but you can update the app.
You can't publish two apps with same package name as google consider it as primary key but story doesn't end here. There are two things you can do:
you can update your app, here updates mean you can remove existing feature, you can add new feature, you can modify existing feature but you have to handle it properly.
But you want the new feature in a separate app then you should change clone your existing code and add new feature and change package name before publishing. (Not Recommended)
If you mean by package name as the applicationId in build.gradle, then the answer is NO. Your new VPN app will overwrite your existing Photo editor app.
If you mean by package name as the package name used by your source codes, then the answer is IT DEPENDS. YES you can use same package name in source code provided that you provide different name for applicationId. NO you cannot if you provide the same name for applicationId regardless of what you use as the package name used by your source codes.
Know the difference here: https://developer.android.com/studio/build/application-id
If you want to release a new app with applicationId (from app/build.gradle) same as any apps before, you can't do it.
If you want to update an existing app with complete new ideas or feature or name or type, having access to that app's signing keys and developer account, yes you can do it. Just release with version code greater than before

What is the difference between changing package name vs applicationId

What is the difference between changing package name vs applicationId to the final apk.
I know it is different for aspect of keeping source code, but lets say I got some app with package name a.b.c.d.
What will be the difference in the builded apk file
if I rename the a.b.c.d into q.w.e.r and then build the apk file
vs
change the applicationId into gradle with q.w.e.r
The package name is just to organize your code.
The applicationId, on the other hand, is used to identify your app in the Play Store. You will change this only if you plan to generate another app based on same code.
From docs (https://developer.android.com/studio/build/application-id.html):
When you create a new project in Android Studio, the applicationId
exactly matches the Java-style package name you chose during setup.
However, the application ID and package name are independent of each
other beyond this point. You can change your code's package name (your
code namespace) and it will not affect the application ID, and vice
versa (though, again, you should not change your application ID once
you publish your app). However, changing the package name has other
consequences you should be aware of, so see the section about
modifying the package name.
Some Android API like google map and firebase ask for your package name when you create the key. That package name they refer to is actually your applicationId. Yup Google insist on using the term package name for these API key. Don't get it confuse.
Taken from doc (https://developer.android.com/studio/build/configure-app-module#set_the_application_id):
"Note: The application ID used to be directly tied to your code's package name; so some Android APIs use the term "package name" in their method names and parameter names, but this is actually your application ID. For example, the Context.getPackageName() method returns your application ID. There's no need to ever share your code's true package name outside your app code."
Application id mostly used for:
Change the application ID for testing
Change the application ID for build variants
In this case, each build variant should be defined as a separate
product flavor. For each flavor inside the productFlavors {} block,
you can redefine the applicationId property, or you can instead append
a segment to the default application ID using applicationIdSuffix, as
shown here:
Every Android app has a unique application ID that looks like a Java
package name, such as com.example.myapp. This ID uniquely identifies
your app on the device and in Google Play Store. If you want to upload
a new version of your app, the application ID (and the certificate you
sign it with) must be the same as the original APK—if you change the
application ID, Google Play Store treats the APK as a completely
different app. So once you publish your app, you should never change
the application ID.
And package name is:
Although your project's package name matches the application ID by
default, you can change it. However, if you want to change your
package name, be aware that the package name (as defined by your
project directory structure) should always match the package attribute
in the AndroidManifest.xml file, as shown here:
The Android build tools use the package attribute for two things:
1- It applies this name as the namespace for your app's generated R.java
class.
Example: With the above manifest, the R class will be
com.example.myapp.R.
2- It uses it to resolve any relative class names
that are declared in the manifest file.
Example: With the above
manifest, an activity declared as is resolved to be
com.example.myapp.MainActivity.
Know more from Source
Once you upload the app on Play store you can't change the application id for that project , if you want to do then google play store consider as a different application.
In case of package name you can change it as you want.

publish Android app with new name and images

I already have an app on android store and want to publish another.
The new one should have different name and images but all the back end is same.
Along with version number what are the things that I have to change to avoid any conflict? Do I have to change package names and all such stuff. Can some one please mention the things I have to change for publishing the new app.
The main identifier for Google Play is application package name. So you should change package name of your app. All other (version code, version name, images etc.) is relevant but is not necessary to be changed.
The final package that is used in your built .apk's manifest, and is
the package your app is known as on your device and in the Google Play
store, is the "application id".
The package that is used in your
source code to refer to your R class, and to resolve any relative
activity/service registrations, continues to be called the "package".
You should read about Configure Build Variants
Do I have to change package names and all such stuff.
A product flavor defines a customized version of the application build by the project. A single project can have different flavors which change the generated application.
android {
productFlavors {
devel {
applicationId "Your Id"
}
prod {
applicationId "Your Id 2"
}
}
}

Categories

Resources