我已经使用 Android Studio 开发了一个移动应用程序,通过从 Play 商店下载它仍然可以工作。该应用程序使用 Firebase 提供的身份验证,并且我从 Google Play Console 添加了 sha1,因此它工作正常。当我想使用 Firebase App Distribution 进行分发时,我无法进行身份验证。
这是我的 build.gradle(应用程序):
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.appdistribution'
android {
compileSdkVersion 28
defaultConfig {
applicationId "..."
minSdkVersion 21
targetSdkVersion 28
versionCode 3
versionName "1.2.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
...
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
firebaseAppDistribution {
releaseNotesFile = "app/release_notes.txt"
testers = "****@gmail.com"
}
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
splits { abi { enable false } }
}
ext {
...
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
...
implementation 'com.google.firebase:firebase-core:17.2.3'
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation 'com.google.firebase:firebase-messaging:20.1.2'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
...
// Analytics
implementation 'com.google.firebase:firebase-analytics:17.2.1'
}
apply plugin: 'com.google.gms.google-services'
这是我的 build.gradle(项目):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-appdistribution-gradle:1.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven{url 'https://jitpack.io'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我正在使用以下命令通过 Android Studio 终端在 Firebase App Distribution 中加载应用程序:
gradlew assembleRelease appDistributionUploadRelease --stacktrace
它工作得很好,除了当我下载应用程序时,身份验证不起作用。
我错过了什么?