仅更改应用程序ID,而不更改程序包名称 [英] Changing only Application ID, not package name

查看:90
本文介绍了仅更改应用程序ID,而不更改程序包名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想更改gradle文件中的应用程序ID,但不想更改程序包名称.
有可能吗?

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

推荐答案

不建议更改您的应用程序ID.您可以做的是更改应用程序后缀.

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

例如,如果您的应用程序ID为 com.example.my_app ,则为不同的构建类型添加不同的后缀,例如为 com.example.myapp.dev 调试.

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.

转到 app/build.gradle 文件,并在 android 块上添加所需的后缀:

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'
        }
    }

详细了解此处

这篇关于仅更改应用程序ID,而不更改程序包名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆