Search code examples
androiddirectorypackageupdating

Changing android package directory structure


lets say i have a published app with package name com.test.app. I want to replace it with an updated app with the package name com.test.app.v3. In android studio, how to I change the updated apps package structure so that all the java code currently in the v3 directory will be placed into the app directory. I know I can manually do it but is their a quick way to do it in android studio.


Solution

  • In Android Studio, You can't change package name quickly.

    1.You should change the package name in build.gradle(Module:app)

    defaultConfig {
            applicationId "com.test.app.v3"
            minSdkVersion 11 // change the values as you want
            targetSdkVersion 23
            versionCode 2
            versionName "1.1"
        }
    

    2.Also change the Package name in AndroidMAnifest.xml

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.test.app.v3">
    

    3.You must change the package name in all java files.

    package com.test.app.v3;
    

    Hope this helps.

    Happy Coding :)