Skip to content Skip to sidebar Skip to footer

Changing Only Application Id, Not Package Name

I only want to change application id in gradle file, but dont want to change package name. Is it possible?

Solution 1:

It is not recommended to change your application id. What you can do is change your application suffix.

As an example, if your application id is com.example.my_app then add different suffixes for different build types, such as com.example.myapp.dev for debug.

Go to app/build.gradle file and on android block add the suffix you want:

buildTypes {
        release {
            applicationIdSuffix ".production"
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            applicationIdSuffix ".dev"
            versionNameSuffix '-DEBUG'
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

Read more about it here

Solution 2:

No problem. You can change your application Id as long as your app is not on store. If you change your application id, It would immediately become a different app for google play.

I have many apps with different package name and application ids.

Solution 3:

Yes you can change androidId in defaultConfig.

    android {
        compileSdkVersion 27
        buildToolsVersion '27.0.3'

        defaultConfig {
            applicationId "com.somepkg"// <- we can change applicationId in defaultConfig
            minSdkVersion 21
            targetSdkVersion 26

            vectorDrawables.useSupportLibrary = true
            ....
        }
}

Also we can change applicationId in flavors use suffix or override it:

flavorDimensions "app"
productFlavors {
        qa {
            dimension "app"
            applicationIdSuffix = ".qa"// <- add suffix (it will be )
        }
        production {
            applicationId = "com.someotherpkg"// <- we can change applicationId in flavors
            dimension "app"
        }
}

However your src files will be still in the same folders.

Post a Comment for "Changing Only Application Id, Not Package Name"