在我在React Native Project中添加了产品口味后,该应用程序在我启动后发行时总是会崩溃。
我试图打开Android Studio来查看LogCat,但是由于该应用程序在开始时崩溃了,所以我看不到任何东西。
这是我的app/build.gladle的一部分:
project.ext.envConfigFiles = [
dev: ".env.local",
production: ".env.production",
staging: ".env.staging"
]
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
android {
flavorDimensions "default"
defaultConfig {
applicationId "com.company"
applicationIdSuffix ""
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
ndk {
abiFilters "armeabi-v7a", "x86"
}
resValue "string", "build_config_package", "com.company"
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro"
}
}
productFlavors {
dev {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
applicationIdSuffix ".dev"
versionNameSuffix "-dev"
}
staging {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
applicationIdSuffix ".staging"
versionNameSuffix "-staging"
}
production {
}
}
}
我也使用fastlane来部署我的应用程序:
lane :staging do |options|
gradle(task: 'clean')
gradle(
task: "assemble",
flavor: "Staging",
build_type: "Release",
print_command: false,
properties: {
"android.injected.signing.store.file" => "file.keystore",
"android.injected.signing.store.password" => options[:storepass],
"android.injected.signing.key.alias" => options[:keyalias],
"android.injected.signing.key.password" => options[:keypass],
}
)
upload_to_play_store(track: 'alpha')
end
尝试重命名您的产品Flavors,例如:
将dev
更改为devTest
。