firebaseAppDistribution-方法build.android()的签名不适用于参数类型:(build_



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

No signature of method: build_clqfykx9rkn9m9ygw4eh6w1bu.android() is applicable for argument types: (build_clqfykx9rkn9m9ygw4eh6w1bu$_run_closure1) values: [build_clqfykx9rkn9m9ygw4eh6w1bu$_run_closure1@60526ded]

我已经完成了这个过程的所有步骤,我的build.gradle文件看起来像这样:

build.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
}

app/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命令(纯属运气(解决了这个问题。任务似乎没有通用命令,必须指定风格。

相关内容

最新更新