Android AssembledBug还生成发布资产
我的目标是为每种构建类型提供不同的google-services.json。我正在使用fastlane来管理不同的构建。当我现在执行fastlane dev命令时,它失败了,因为我在发布文件夹中没有任何google-services.json文件 这是我用于构建调试构建的fastlane脚本:Android AssembledBug还生成发布资产,android,android-studio,react-native,gradle,android-gradle-plugin,Android,Android Studio,React Native,Gradle,Android Gradle Plugin,我的目标是为每种构建类型提供不同的google-services.json。我正在使用fastlane来管理不同的构建。当我现在执行fastlane dev命令时,它失败了,因为我在发布文件夹中没有任何google-services.json文件 这是我用于构建调试构建的fastlane脚本: desc "Clean, build development release" lane :dev do |options| if options[:clean] clean_
desc "Clean, build development release"
lane :dev do |options|
if options[:clean]
clean_android
end
rntest
test
gradle(
task: "assemble",
build_type: "debug",
project_dir: "./")
end
当我执行fastlane dev时,我得到以下错误:
任务“:app:processReleaseGoogleServices”的执行失败
缺少文件google-services.json。没有它,谷歌服务插件就无法运行。搜索位置:/Users/appfoundry/Documents/GitHub/afst18gv/digitalreceptionister/android/app/src/release/google-services.json /Users/appfoundry/Documents/GitHub/afst18gv/digitalreceptionister/android/app/google-services.json 正如您所见,它正在发布文件夹中查找google-services.json。奇怪的是,在我的日志输出中,我可以看到它已经正确解析了debug文件夹中的google-services.json。它还会在调试后以某种方式触发所有发布生成器: :app:prepareDebugDependencies:app:compiledbugaidl最新 :app:CompiledBugRenderScript最新:app:GeneratedBugBuildConfig 最新:app:mergeDebugShaders最新:app:compileDebugShaders 最新:app:generateDebugAssets最新:app:mergeDebugAssets 最新:app:processDebugGoogleServices解析json文件: /Users/appfoundry/Documents/GitHub/afst18gv/digitalreceptionister/android/app/src/debug/google-services.json :app:processDebugManifest最新:app:fabricGenerateResourcesDebug :app:generateDebugResValues最新:app:generateDebugResources :app:mergeDebugResources:app:bundleDebugJsAndAssets扫描文件夹 对于中的符号链接 /用户/appfoundry/Documents/GitHub/afst18gv/DigitalReceptionator/node_模块 (23毫秒)扫描文件夹中的符号链接 /用户/appfoundry/Documents/GitHub/afst18gv/DigitalReceptionator/node_模块 (21ms)加载依赖关系图,完成。警告:转换缓存已损坏 被重置。bundle:开始bundle:完成bundle:写入bundle输出 致: /Users/appfoundry/Documents/GitHub/afst18gv/digitalReception/android/app/build/intermediates/assets/debug/index.android.bundle 捆绑包:已完成写入捆绑包输出捆绑包:复制8个资产文件 捆绑:复制完资产:app:processDebugResources :app:generateDebugSources :app:IncrementalDebugJavaCompilationProtection :app:compileDebugJavaWithJavac:app:compileDebugJavaWithJavac-不是 增量(例如,输出已更改,没有以前的执行等)。 :app:IncrementalDebugUnitTestJavaCompilationProtection最新版本 :app:preDebugUnitTestBuild-TO-DATE :app:prepareDebugUnitTestDependencies :app:CompiledBugUnitTestJavaWithJavaC最新版本 :app:processDebugJavaRes最新:app:processDebugUnitTestJavaRes 最新:应用程序:CompiledBugUnitTestSources最新 :app:mockableAndroidJar最新:app:assembleDebugUnitTest 最新:app:testDebugUnitTest最新:app:checkReleaseMifest :app:prepareReleaseDependencies:app:compilerReleaseAIDL最新 :app:compileReleaseRenderscript最新版本 :app:generateReleaseBuildConfig最新:app:mergeReleaseShaders 最新:应用程序:CompilerReleaseShaders最新 :app:generateReleaseAssets最新:app:mergeReleaseAssets 最新:应用程序:processReleaseGoogleServices失败 正如您在这里看到的,调试完成后,它会执行所有类型的发布操作 这是我的build.gradle文件
apply plugin: "com.android.application"
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js",
bundleInRelease: true,
bundleInDebug: false,
bundleInStaging: true,
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "be.appfoundry.digitalreceptionist"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
def env = System.getenv()
versionName "1.0.0." + env['BUILD_NUMBER']
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword "afst18gv"
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword "afst18gv"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
staging {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
applicationIdSuffix ".staging"
signingConfig signingConfigs.release
}
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
debug {
applicationIdSuffix ".debug"
}
}
dexOptions {
jumboMode true
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-splash-screen')
compile(project(':react-native-firebase')) {
transitive = false
}
compile project(':react-native-push-notification')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.facebook.react:react-native:+'
compile project(':react-native-maps')
compile project(':react-native-navigation')
// From node_modules
compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true
}
compile(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
// Firebase dependencies
compile "com.google.android.gms:play-services-base:11.8.0"
compile "com.google.firebase:firebase-core:11.8.0"
compile "com.google.firebase:firebase-auth:11.8.0"
compile "com.google.firebase:firebase-firestore:11.8.0"
compile "com.google.android.gms:play-services-maps:11.8.0"
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'