我为我的应用程序配置了不同的风格。当我在同一台设备上安装这两种口味时,就会出现一个巨大的问题。
当我打开 App1(Flavour 1)然后最小化它(单击 Home 按钮)并尝试打开 App2(Flavour 2)时,它会打开 App1(Flavour1)。为了打开 App2,我必须从最近删除 App1,然后打开 App2。反之亦然。
我也尝试使用不同的风味维度。这是我目前的配置。
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
flavorDimensions("default")
defaultConfig {
applicationId "com.xx.aa"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable 'RestrictedApi'
}
productFlavors {
aa {
applicationId "com.xx.aa"
versionCode 12
versionName "1.0.1"
manifestPlaceholders = [
appName: 'aa',
appId : 'com.xx.aa'
]
buildConfigField "boolean", "XXXX", "false"
}
bb {
applicationId "com.xx.bb"
versionCode 2
versionName "1.2.3"
manifestPlaceholders = [
appName: 'bb',
appId : 'com.xx.bb'
]
buildConfigField "boolean", "XXXX", "true"
}
}
我的清单
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xx.aa">
<!-- few permissions-->
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<application
android:name=".global.aaApplication"
android:allowBackup="false"
android:fullBackupContent="false"
android:icon="@drawable/ic_launcher_default"
android:label="${appName}"
android:roundIcon="@drawable/ic_launcher_default"
android:supportsRtl="true"
android:theme="@style/AppCompactTheme">
<activity
android:name=".activity.SplashActivity"
android:screenOrientation="portrait"/>
.
.
.
</application>
</manifest>