Android 共存debug release版, 并设置不同名字
一部手机上同时安装app的debug版和release版,并显示不同名字
build.gradle
buildTypes {
debug {
applicationIdSuffix ".debug"
resValue "string", "app_name", "@string/app_name_debug"
}
release {
applicationIdSuffix ".release"
resValue "string", "app_name", "@string/app_name_release"
}
}
strings.xml
<resources>
<string name="app_name_debug">Debug</string>
<string name="app_name_release">Release</string>
</resources>
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
debug release版使用不同的ic_launcher
在src下面创建debug-res-mipmap-xx, 放入对应的ic_launcher.png