gpt4 book ai didi

android - firebaseAppDistribution - 方法 : build. android() 的无签名适用于参数类型:(build_run_closure1) 值:[build_run_closure1@x

转载 作者:行者123 更新时间:2023-12-05 00:02:17 25 4
gpt4 key购买 nike

我有一个电容器应用程序,我正在尝试使用 Gradle ( https://firebase.google.com/docs/app-distribution/android/distribute-gradle?authuser=1&apptype=aab ) 实现 Firebase 分发,但我遇到了这个错误:

No signature of method: build_clqfykx9rkn9m9ygw4eh6w1bu.android() is applicable for argument types: (build_clqfykx9rkn9m9ygw4eh6w1bu$_run_closure1) values: [build_clqfykx9rkn9m9ygw4eh6w1bu$_run_closure1@60526ded]
我已经完成了该过程的所有步骤,我的 build.gradle 文件如下所示:
构建.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'com.google.gms:google-services:4.3.5'

// Add the App Distribution Gradle plugin
classpath 'com.google.firebase:firebase-appdistribution-gradle:2.2.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

apply from: "variables.gradle"

allprojects {
repositories {
google()
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

应用程序/build.gradle:
apply plugin: 'com.android.application'

// Apply the App Distribution Gradle plugin
apply plugin: 'com.google.firebase.appdistribution'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.some.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName project.hasProperty('version') ? version : '1.0.0'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
}
flavorDimensions "environment"
productFlavors {
appA {
dimension "environment"
manifestPlaceholders = [displayName:"App A"]
}
appB {
dimension "environment"
applicationIdSuffix ".amigdala"
manifestPlaceholders = [displayName:"App B"]
}
}
signingConfigs {
release {
storeFile file("app-keystore.jks")
storePassword System.getenv("KSTOREPWD")
keyAlias "mykey"
keyPassword System.getenv("KEYPWD")
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
// https://firebase.google.com/docs/app-distribution/android/distribute-gradle?authuser=1&apptype=aab
firebaseAppDistribution {
serviceCredentialsFile "./service-account-key-distribution.json"
artifactType "AAB"
archivePath System.getenv("ARCHIVE_PATH")
releaseNotes "Change this before releasing in production!"
}
}
}
}

repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation project(':capacitor-android')
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')
}

apply from: 'capacitor.build.gradle'

try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
当然,在我添加这部分之前,一切正常:
 // https://firebase.google.com/docs/app-distribution/android/distribute-gradle?authuser=1&apptype=aab
firebaseAppDistribution {
serviceCredentialsFile "./service-account-key-distribution.json"
artifactType "AAB"
archivePath System.getenv("ARCHIVE_PATH")
releaseNotes "Change this before releasing in production!"
}
我在修改 build.gradle 文件方面非常陌生,所以我猜这与语法有关,但我无法弄清楚。即使我做了一些小的改变,比如 artifactType "AAB" -> artifactType="AAB"我一直从这个错误跳到这个错误: Task 'appDistributionUploadRelease' not found in root project 'android'.任何帮助或线索将不胜感激,谢谢。

最佳答案

方法没有签名:build.android... 当您的 Gradle 配置出现问题时出现接缝,例如 firebaseAppDistribution 属性中缺少属性或文件路径错误。一旦我修复了在根项目'android'问题中找不到任务'appDistributionUploadRelease',我解决了(纯属运气)更改appDistributionUploadAppARelease的appDistributionUploadRelease命令。似乎该任务没有通用命令,并且必须指定 flavor 。

关于android - firebaseAppDistribution - 方法 : build. android() 的无签名适用于参数类型:(build_run_closure1) 值:[build_run_closure1@x,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70393274/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com