How to rename app package in flutter project? - android

I want to rename my app package.
I can't upload my app on play store because my app package is com.example.example. How can I change it easily?

For Android
Goto, app level build.gradle and specify your unique applicationID
defaultConfig {
applicationId "your-package-name"
minSdkVersion 16
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
For IOS
Goto, Info.plist inside ios/Runner directory and change the bundler identifier
<key>CFBundleIdentifier</key>
<string>com.your.packagename</string>

This is a quick way of getting it done using project level find and replace. Click CTRL + SHift + R Then type the name of the old package name com.old.package_name, this will show you everywhere the old package name is used in the project. Then type the name of the new package name you want to replace it with in the lower tab: com.new.package_name then click replace all. This worked for me.

Related

Version code is changed automatically in build

When I generate play store apk then version code is changed automatically. Here is how I define version in flavouring. How can I fix it? Any help is highly appriciated.
core {
dimension DIMENSION_APP_TYPE
applicationId "com.xyz"
versionCode 17
versionName "1.1.6"
}
26323252

React native android build version code not updating

I have edited the versionCode in both the android\app\build.gradle file :
versionCode 2
versionName "2.0"
and I have updated the AndroidManifest.xml file
package="com.reactnativeapp"
android:versionCode="2"
android:versionName="2.0"
BUT I still get this error when I try to release an update to my app on google play store!
You need to use a different version code for your APK or Android App Bundle
because you already have one with version code 1.
I have tried running
gradlew clean
in the android folder and rebuilding the project and nothing has worked. Does anyone have any ideas?
Make sure that you have your versionCode and versionName set inside defaultConfig like this:
android {
...
defaultConfig {
versionCode = 2
versionName = "2.0"
}
...
}
You might have it set up for a debug-only config, which wouldn't change for release builds.

Can I launch android app with default package name given by android studio?

i started working on a project on android studio , initially i didn't know if I would go to launch the app so i let the package name be the same as given by android studio by default ( it was com.example.abhishek.tv ) .
Now I'm done with the app and want to launch it but here I got stuck as I'm having my domain name as abhishekint.16m.com but i don't know to change the default package name given by android studio .
I have three problems here
I don't know to change the package name efficiently and SAFELY. I'm reluctant while changing the package name after reading some of the stackoverflow links as I was not clear with the answer and package name seems very sensible as it can ruin the whole project if not done properly .
My original domain name has numerics and I found after searching online that there is something abnormal with the numeric domain name .
One more thing , as I've this app which has some of the videos from youtube so in case if I choose to change the package name of my project then will I have to change the package name of the API_KEY that i got after fingerprinting while getting the youtube API .
Change in your app-level build.gradle file
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.abc.xyz" // change here
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
This will override package name that exist in AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abc.xyz">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
EDIT
From the documentation about naming packages in Java:
In some cases, the internet domain name may not be a valid package
name. This can occur if the domain name contains a hyphen or other
special character, if the package name begins with a digit or other
character that is illegal to use as the beginning of a Java name
This means you can't use a digit as the first character of a package (or a class, interface or variable name, for that matter).
abhishekint.16m.com not allowed but you can use abhishekint.sixteenm.com.

google play application upload failed

apk upload failed to the google play market.
I am trying to upload the upgraded version of my app to the google play but I am keep getting the message -
Upload failed
You need to use a different version code for your APK because you already have one with version code 1.
Your APK needs to have the package name com.corntail.project.
There is still something that is looking for com.corntail.project and it is not being found.
UPDATE:
In my AndroidManifest.xml, the relevant code is -
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.corntail.main"
android:versionCode="1"
android:versionName="1.0" >
If you're using Android Studio or building with gradle, edit your gradle script (build.gradle) to change your package name and version. These values overwrite your AndroidManifest.xml file.
For example:
defaultConfig {
applicationId "com.xyz.abc"
minSdkVersion 16
targetSdkVersion 19
versionCode 2
versionName "1.1"
}
You need to change your android:versionCode="1" to 2 on the AndroidManifest...
Things you have to keep in mind when updating your application on Google Play :
Change Version code +1 depending on the old value - if it's 1 , you have to change it to a bigger number.
Change your App Version Name to something bigger / different if it's string - if your old version is 1.0 - it should be 1.1 / 1.0.1 or whatever you like (it's always a better option t have some version name strategy, if it will contains the date update addded or the revision it depends on you).
And if you want to be able to update your app, don't change project package name! That's how android system knows that this application is different than that one. If you change your package name, it's now acting like a new app and you won't be able to update it from Google Play Store! To change your package name to com.corntail.project first you need to change it in manifest and after that in your project's main package and you need to keep track of your activities, if you declared them with package name too. For example :
if your MainActiivty was declared in manifest like :
com.corntail.main.MainActivity
you need to change it now to be like :
com.corntail.project.MainActivity.
You need to use a different version code for your APK because you
already have one with version code 1.
You must change your version code in your androidmanifest.xml
Every time you update your app change this variable in you XML file:
android:versionCode="1"
You are getting 2 errors.
The Version Code: you always need to set a higher number in the versionCode and always use an integer number. (don't use 1.1)
android:versionCode="1"
The package name: it has to match the same string that you used in the latest version that you upload. So instead of package="com.corntail.main" you should use:
package="com.corntail.project"
After modify the AndroidManifest.xml save it and then search in the folder src the package called "com.corntail.main", right click, Refactor > Rename, and the new name should match what you put in package (in this example you should call it: 'com.corntail.project') and you are done!
Good luck!
You have change version code in increasing order i.e. 1,2,3...so on as every time you uploaded. In every upload version code should have greater number than previous upload version code. You can change version code in APP Module Build.gradle file.
Image
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.xyz"
minSdkVersion 14
targetSdkVersion 24
versionCode 5
versionName "1.1.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
If you build with gradlew, you should check the build.gradle file,
the applicationId will overwrite the package value in the AndroidManifest.xml
android {
defaultConfig {
applicationId "xxx.xxx.xxx"
}
}

Bundle ID in android

What is meant by bundle ID in android, What is its usage, And can two android apps have same bundle ID? if YES then why? and if NO then why
A bundle ID otherwise known as a package in Android is the unique identifier for all Android apps. It needs to be unique as when you upload it to Google Play it identifies and publishes your app using the package name as the unique app identification.
Really it is the only thing which is necessary to identify your app, and generally it has 3 parts:
com.example.testapp
Where example is generally the company/publishers name, and testapp is the appname.
You will not be able to upload an APK to the store which has the same package as another app already in the store.
Should you ever need to change the package name in Eclipse, do the following:
Right click project > Android Tools > Rename Application Package...
BundleID is a Unique Identifier for Identifying your app on Google Play Store. You can Note that for each apps on Google Play something like this:
https://play.google.com/store/apps/details?id = com.yourdomain.appname
You cannot assign the same BundleId for more than one App. This is because the Google Play uses your BundleID as Unique Identifier for your app.
So, you can configure your BundleID in Android Studio by editing your applicationId property in app level gradle as shown below:
android {
compileSdkVersion 27
defaultConfig {
//Edit the applicationId for changing your BundeID.
applicationId "com.yourdomainname.yourappname"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

Categories

Resources