Return to site

Android Change Package Name

broken image


I've recently had to change the package name of the app that I was working on for a client twice. I noticed that this isn't exactly intuitive to do in Android Studio, so this will be a short little guide to doing that.

As a preface, I'm running Android Studio 2.2.3. Whether you're an older version of Android Studio or newer version if you're reading this from the future, I'm pretty sure the interface would be relatively similar.

The Android build tools use the package attribute for two things: It applies this name as the namespace for your app's generated R.java class It uses package name to resolve any relative class.

Android change package name
Change
Package

Anyways, let's say that this is the app I'm working with where the package name is 'com.toasterbits.customsearchviewrecipe' and I want to change the package name to 'com.coffee.beans'. First thing we should do is open up AndroidManifest.xml file and change the package field in the manifest bracket from 'com.toasterbits.customsearchviewrecipe' to 'com.coffee.beans'.

='' <manifest='' xmlns:android='http://schemas.android.com/apk/res/android' package='com.coffee.beans' >='' <application='' android:allowbackup='true' android:icon='@mipmap/ic_launcher' android:label='@string/app_name' android:supportsrtl='true' android:theme='@style/AppTheme' >='' <activity>='' ..='' </activity>='' </application>=''>

Change Package Name: Right Click on Project Android Tools Rename Application Package. Go to src right click on your main package Refactor Rename. Go to manifest file and change your package name. Change ID of the Application (Name and Package also) Changing the id of the application does change the application itself. It is a completely. ID of the package is unique identifier of the app, distinguishing from other apps. Here are the simple steps to change the package name in android. Click on your pack name (in source tree). Right Click - Refractor - Rename as shown below - Click on rename, it will show pop up as shown below - Click on Rename package, it will show new pop up as shown below.

2
4
6
8
10
12
14
xmlns:android='http://schemas.android.com/apk/res/android'
android:allowBackup='true'
android:label='@string/app_name'
android:theme='@style/AppTheme'>
..

After you do that, open up your app's 'build.gradle' file and change the applicationId in the defaultConfig bracket to the new package name

Package
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
compileSdkVersion25
defaultConfig{
applicationId'com.toasterbits.customsearchviewrecipe'
targetSdkVersion25
versionName'1.0'
testInstrumentationRunner'android.support.test.runner.AndroidJUnitRunner'
buildTypes{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
compile fileTree(dir:'libs',include:['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',{
exclude group:'com.android.support',module:'support-annotations'
compile'com.android.support:appcompat-v7:25.1.0'
testCompile'junit:junit:4.12'
// Blah blah blah

Android Change Package Name Apk

After we do this, we are now ready to change the actual package names themselves.

Android Change Package Name

In Android Studio, click that little wheel looking bar button in your Projects panel.

There, uncheck/deselect the setting 'Compact Empty Middle Packages'. Once you do that, your package names in your Projects panel will be broken up from 'com.toasterbits.customsearchviewrecipe' to something like 'com' -> 'toasterbits' -> 'customsearchviewrecipe'. It'll look something like this

From here, right click on the portion of the package name you want to modify. In my case, it'll be both 'toasterbits' and 'customsearchviewrecipe'. Once you right click, go to 'Rename' and then 'Refactor'. Choose your new package name and choose 'Rename Package' instead of 'Rename Directory'.

Do this until you get the package name you want.

After that, resync your project from build.gradle file, clean your project, and then rebuild your project.

And voila! You have just changed the package name of you Android app.

Subscribe to the Newsletter!

Sign up for my email newsletter to get updates on remote work, Android development, and etc.

How to Solve Error:Execution failed for task No matching client found error Android Studio Java

This simple tutorial may help you to fix the following android studio error

Error:Execution failed for task ':app:processAllcategoriesDebugfreeGoogleServices'. No matching client found for package name 'com.my.app.package.name.debug'

The most common causes for this error to occur is because you have changed your existing app project package name id, changed package id that already had admob integration, or played around with google-services.json file, so the app id is not matching in the google-services.json file.


here is a way to fix it.

Minecraft fnaf universe mod free download. In android studio, select Project Files window and then select app folder. then navigate to google-services.json

Open google-services.json file

Change the package name in this file, see the line marked in Red, type there your app package name id, example; com.myapp.android.

Sync or refresh your project after doing this, your error should be fixed now.

Android

Anyways, let's say that this is the app I'm working with where the package name is 'com.toasterbits.customsearchviewrecipe' and I want to change the package name to 'com.coffee.beans'. First thing we should do is open up AndroidManifest.xml file and change the package field in the manifest bracket from 'com.toasterbits.customsearchviewrecipe' to 'com.coffee.beans'.

='' <manifest='' xmlns:android='http://schemas.android.com/apk/res/android' package='com.coffee.beans' >='' <application='' android:allowbackup='true' android:icon='@mipmap/ic_launcher' android:label='@string/app_name' android:supportsrtl='true' android:theme='@style/AppTheme' >='' <activity>='' ..='' </activity>='' </application>=''>

Change Package Name: Right Click on Project Android Tools Rename Application Package. Go to src right click on your main package Refactor Rename. Go to manifest file and change your package name. Change ID of the Application (Name and Package also) Changing the id of the application does change the application itself. It is a completely. ID of the package is unique identifier of the app, distinguishing from other apps. Here are the simple steps to change the package name in android. Click on your pack name (in source tree). Right Click - Refractor - Rename as shown below - Click on rename, it will show pop up as shown below - Click on Rename package, it will show new pop up as shown below.

2
4
6
8
10
12
14
xmlns:android='http://schemas.android.com/apk/res/android'
android:allowBackup='true'
android:label='@string/app_name'
android:theme='@style/AppTheme'>
..

After you do that, open up your app's 'build.gradle' file and change the applicationId in the defaultConfig bracket to the new package name

2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
compileSdkVersion25
defaultConfig{
applicationId'com.toasterbits.customsearchviewrecipe'
targetSdkVersion25
versionName'1.0'
testInstrumentationRunner'android.support.test.runner.AndroidJUnitRunner'
buildTypes{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
compile fileTree(dir:'libs',include:['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',{
exclude group:'com.android.support',module:'support-annotations'
compile'com.android.support:appcompat-v7:25.1.0'
testCompile'junit:junit:4.12'
// Blah blah blah

Android Change Package Name Apk

After we do this, we are now ready to change the actual package names themselves.

Android Change Package Name

In Android Studio, click that little wheel looking bar button in your Projects panel.

There, uncheck/deselect the setting 'Compact Empty Middle Packages'. Once you do that, your package names in your Projects panel will be broken up from 'com.toasterbits.customsearchviewrecipe' to something like 'com' -> 'toasterbits' -> 'customsearchviewrecipe'. It'll look something like this

From here, right click on the portion of the package name you want to modify. In my case, it'll be both 'toasterbits' and 'customsearchviewrecipe'. Once you right click, go to 'Rename' and then 'Refactor'. Choose your new package name and choose 'Rename Package' instead of 'Rename Directory'.

Do this until you get the package name you want.

After that, resync your project from build.gradle file, clean your project, and then rebuild your project.

And voila! You have just changed the package name of you Android app.

Subscribe to the Newsletter!

Sign up for my email newsletter to get updates on remote work, Android development, and etc.

How to Solve Error:Execution failed for task No matching client found error Android Studio Java

This simple tutorial may help you to fix the following android studio error

Error:Execution failed for task ':app:processAllcategoriesDebugfreeGoogleServices'. No matching client found for package name 'com.my.app.package.name.debug'

The most common causes for this error to occur is because you have changed your existing app project package name id, changed package id that already had admob integration, or played around with google-services.json file, so the app id is not matching in the google-services.json file.


here is a way to fix it.

Minecraft fnaf universe mod free download. In android studio, select Project Files window and then select app folder. then navigate to google-services.json

Open google-services.json file

Change the package name in this file, see the line marked in Red, type there your app package name id, example; com.myapp.android.

Sync or refresh your project after doing this, your error should be fixed now.

Update: If you are new to android development, or just can't fix this error, i can fix it for you for a small fee of US $2 (₹120 indian rupees). Just send me your project through email or google drive, i will fix your project and send it back to you. You can pay me through Paypal, Direct Bank Transfer (NEFT,IMPS,UPI) etc. i do this service to all countries. For more details, contact me through [email protected] or [email protected]

Related





broken image