Changing Package name for an application - android

I need to deploy two application on the play store :
Eg:
com.android.myapppro and com.android.myappfree both have similar code but small changes like [Show/Hide Ads]
So while changing the package name of the application updating the Gradle file
applicationId "com.android.myapppro"
To
applicationId "com.android.myappfree"
is sufficient, or do i need to update the AndroidManifest.xml also.
Changing the AndroidManifest.xml will force me to update the R imports in all the classes.
Please Help!
Thanks in advance.

From ApplicationId versus PackageName
Therefore, we have decoupled the two usages of package name:
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 need to change only applicaitonId and left AndroidManifest.xml as is.

Related

App on Play store. Changed package name in Java. What part of Manifest needs old package name?

I released an app on Play store a few years ago.
The package name was com.X.Y.appName
This week, I found the old source code and got it all working in Android Studio 14.
I did not like the package name for my Java code to be com.X.Y.appName
So, I changed the Java code to com.Z.appName
The Java code was fine with that, and everything runs fine in the emulator testing.
However, I now want to release the new version in the Play store.
So, how do I release this new project that is recoded as package com.Z.appName to be released as an update to com.X.Y.appName ?
The manifest.xml file references the package twice
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Z.appName">
and
<activity android:name="com.Z.appName.MainActivity">
Which of these needs to remain in the original package name to keep this App release to be considered an update, and not a brand new app ?
I tried to revert the first package name under the manifest tag back to com.X.Y.appName, and my code would no longer compile. I am now getting "error: package R does not exist". So, I put it back to com.Z.appName.
If I change the 2nd one in the activity tag, the code turns red, and I get "Class not found" error.
So, how do I release this new project that is recoded as package com.Z.appName to be released as an update to com.X.Y.appName ?
Do I leave the 2 entries above in manifest.XML to retain the new package name of com.Z.appName, but revert to the original com.X.Y.appName somewhere else entirely?
Build. Gradle?
I think I found a way. Does this seem correct?
I changed the manifest to the original package name
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.X.Y.appName">
Then I added this in MainActivity.java
import com.X.Y.appName.R;
The project now compiles and works, and the manifest has the old project name.
Do I need to edit build.gradle as well ?
Currently, it shows the new package name
defaultConfig {
applicationId "com.Z.appName"

base manifest is missing android:icon. You need to use a different package name because "com.example" is restricted

I am releasing my android app project on play store. So After reading some blogs I decided to put that app for testing to some limited users and then publish the app. But when I uploaded the package of my app in play store then an error in red line comes like:
Your base manifest is missing android:icon. nullLearn more about android:iconnull.
You need to use a different package name because "com.example" is restricted.
Why this error is popping, I already done setting my icon. And also what is the meaning of this line "com.example" is restricted..
Issue 1: Your base manifest is missing the android:icon attribute
Open your app's manifest file, go to the <application> tag. Inside the <application> tag, you need to set your app's icon with the android:icon attribute. See the below code for a reference:
<application
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:networkSecurityConfig="#xml/network_security_config"
android:supportsRtl="true"
android:theme="#style/AppTheme"/>
Issue 2: You need to use a different package name because "com.example" is restricted
The package name is the unique identifier for your application. "com.example" is the default package name for Android applications so you need to change your application package name. Follow this tutorial to change the app package name.
You cannot upload your apk to play store using com.example package name. Your package name should be unique in nature, you need to change your package name
Change package name

The problem of not installing application on google play

When I uploaded it to google play, I got a com.example error, and then I typed another name instead of example and fixed all the places. I also corrected the package name in the google service json file. But it does not receive an error but when I run the application I get a "myappname" is stopped error. I have no idea what the problem is. What could it be? Where did the missing or wrong?
places where I make correction;
package names in all activity and fragments
googleservice.json file
package name in manifest
What is the problem?
You need to update in your build.gradle file like this
android {
applicationId "your.new.domain"
}
And then, Sync the project.

cordova_plugin_file_chooser not working in same device for two different apps

I am using cordova cli for creating android app.
I have user cordova_plugin_file_chooser
Where it given that below
Note that like a ContentProvider, the DocumentProvider authority must be unique. You should change com.ianhanniballake.localstorage.documents in your Manifest, as well as the LocalStorageProvider.AUTHORITY field.
By above I have update in my AndroidManifest by changing android:authorities="com.crypho.localstorage.documents" to com.12345.localstorate.documents but when I build app using cordova build android it added new instance in manifest file with existing name android:authorities="com.crypho.localstorage.documents"
Can anybody know where should I changed in the code exactly?
UPDATE:
Still not resolved the issue of provider name confict.
I resolved issue by replacing provider authorities by ${applicationID}.Provider in <provider> of that specific plugin in android.json file.
Thanks

Change default package from com.example for Eclipse Android projects

I am using Eclipse 4.2 with Android SDK.
I am wondering if it is possible to change the default package ID com.example that shows in the "New Android Application" wizard as you type the application name?
I would like it to default to my own package ID so that I don't need to correct the Package Name field each time.
Is this possible to do? Please explain how.
No, you cannot change the default; it's hardcoded in the plugin sources.
(For the curious, it's in com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectPage#SAMPLE_PACKAGE_PREFIX in the ADT code base). We should consider persisting the most recently set package prefix and inserting the parent package next time. Feel free to file an issue for that at http://b.android.com category Component-Tools.
-- Tor
With Android Studio not running, edit the file: C:\Users\MyAccount\.AndroidStudio\config\options\options.xml (replace C: with the installation drive and MyAccount with your account name).
Within the xml file look for "property name="SAVED_COMPANY_DOMAIN" value=" and change the value to what you want.
Following user2232952's guidance, for new versions of Android Studio change the value of:
<property name = "SAVED_ANDROID_PACKAGE" value = "com.example" />
I'm not sure why so many people have right answers with wrong file location...
I've installed android studio 2020.3 with all default settings and the file others.xml is in folder
C:\Users\MYUSER\AppData\Roaming\Google\AndroidStudio2020.3\options
For anyone coming here in 2020, the file you are looking for is other.xml
It can be found in your AndroidStudio library under config/options/other.xml
(For mac this is probably ~/Library/Application Support/Google/AndroidStudio4.1/options)
Then you can follow the instructions by #Murillo Comino
<property name = "SAVED_ANDROID_PACKAGE" value = "com.example" />
EDIT:
As per #Douglas Kazumi 's comment, it is important that AS will be closed while editing this.
If you've already created your project, you could go to your AndroidManifest.xml file and update the attribute in the Manifest (root) tag
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name"
android:versionCode="1"
android:versionName="1.0" >
Just make sure the rest of your code also reflects this change.
Click the package name and hit Alt+Shift+R and Rename, it will update everything!

Categories

Resources