简体   繁体   English

使用 Firebase 应用分发服务导致应用未安装错误

[英]Using Firebase App Distribution service is resulting in app not installed error

I'm using the Firebase app distribution service for the Android platform.我正在为 Android 平台使用Firebase 应用分发服务 For automatic distributions, I've set up the Gradle file according to the steps mentioned in the docs .对于自动分发,我根据文档中提到的步骤设置了 Gradle 文件。 The setup and auth are successful.设置和验证成功。 The distribution is also successful.分发也很成功。 But once I download the app using Firebase's App Tester app for Android, it results in app not installed error.但是,一旦我使用 Firebase 的 Android 的 App Tester 应用程序下载该应用程序,就会导致应用程序未安装错误。 This is for both: debug as well as release variant.这适用于两者:调试和发布变体。

I tried installing the app after disabling the Google play protect, but the issue remains.我在禁用 Google Play Protect 后尝试安装该应用程序,但问题仍然存在。 Can someone please help me regarding this?有人可以帮我解决这个问题吗?

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

I ran into this issue with a customer and it turned out that she needed to delete the version of the app that was on her phone to get this to work.我与一位客户遇到了这个问题,结果她需要删除手机上的应用程序版本才能使其正常工作。 (It was a previously installed non Firebase version) (是之前安装的非Firebase版本)

The reason of the message "Installation Failed" or "App not installed" can vary, simply because this is the only error you can get while installing your app.消息“安装失败”或“未安装应用程序”的原因可能会有所不同,仅仅是因为这是您在安装应用程序时可能遇到的唯一错误。 I agree that it is not helpful.我同意这没有帮助。

However, it is for most cases due to a signing issue.但是,在大多数情况下,这是由于签名问题。 Here are some solutions:以下是一些解决方案:

  1. Make sure you used a Release Signed APK for your Firebase Distribution.确保您为 Firebase 分发版使用了发布签名的 APK。 https://developer.android.com/studio/build/build-variants#signing https://developer.android.com/studio/build/build-variants#signing

在此处输入图像描述

  1. When you generate your signed APK, you can choose V1 or V2 signatures.当您生成签名的 APK 时,您可以选择 V1 或 V2 签名。 Try using the V1 signature.尝试使用 V1 签名。 V2 signature was a feature introduced in Android 7.0: https://developer.android.com/about/versions/nougat/android-7.0#apk_signature_v2 V2 签名是 Android 7.0 中引入的一项功能: https://developer.android.com/about/versions/nougat/android-7.0#apv

  2. Make sure your app is signed correctly, by checking the values in your file, app/build.gradle :通过检查文件app/build.gradle中的值,确保您的应用程序已正确签名:

     android {... defaultConfig {...} signingConfigs { release { storeFile file("myreleasekey.keystore") storePassword "password" keyAlias "MyReleaseKey" keyPassword "password" } } buildTypes { release {... signingConfig signingConfigs.release } }

    } }

Last but not least, make sure that your phone has enough storage to install the app, and that the option "Install from unknown sources" is checked in the settings.最后但并非最不重要的一点是,确保您的手机有足够的存储空间来安装该应用程序,并在设置中选中“从未知来源安装”选项。

I had the same issue.我遇到过同样的问题。 So I checked the logs and found this when the installation failed:所以我检查了日志,在安装失败时发现了这个:

2019-10-07 10:20:29.941 771-2406/? E/ResolverController: No valid NAT64 prefix (114, <unspecified>/0)
2019-10-07 10:20:30.740 1278-1537/? W/NativeHelper: Failure copying native libraries [errorCode=-113]
2019-10-07 10:20:30.740 1278-1537/? E/PackageInstallerSession: Commit of session 392193568 failed: Failed to extract native libraries, res=-113

So I assumed there had to be something wrong with my APK-file I used.所以我认为我使用的 APK 文件一定有问题。 I pressed Build -> Build APK(s) and uploaded that file to Firebase when it was done.我按下 Build -> Build APK(s) 并在完成后将该文件上传到 Firebase。 I'm not sure I actually went through the build process the first time or just grabbed the apk directly from the build folders.我不确定我是否真的第一次经历了构建过程,或者只是直接从构建文件夹中获取了 apk。 It may have been corrupted or just the wrong one.它可能已损坏或只是错误的。 I recommend just doing the steps one more time and make sure you build the correct one and upload that.我建议再执行一次这些步骤,并确保构建正确的步骤并上传。

Make sure you are providing a signingConfigs to each of your variants.确保您为每个变体提供了一个signingConfigs配置。

add to your app's build.gradle 's android tag the following code:将以下代码添加到您应用的build.gradleandroid标记中:

signingConfigs {
    config {
        keyAlias '<YOUR_ALIES>'
        keyPassword '<YOUR_KEY_PASSWORD>'
        storeFile file('<YOUR_KEY_PATH>') // Usually use '../keystore.key'
        storePassword '<YOUR_STORE_PASSWORD>'
    }
}

Finally, add the following line into each variant in your buildTypes in your app's build.gradle :最后,将以下行添加到应用程序build.gradlebuildTypes中的每个变体中:

signingConfig signingConfigs.config

Hope this helps.希望这可以帮助。

This is a random error (apparently).这是一个随机错误(显然)。

What worked for me was manually deleting the build folder inside the app module (simply cleaning the project does not delete all the compiled code), build the APK again, re-upload it on FAD and then the APK installed successfully.对我有用的是手动删除app模块中的build文件夹(只是清理项目不会删除所有编译的代码),再次构建 APK,在 FAD 上重新上传,然后 APK 安装成功。

The reason this happens is that the APK that you generated may not be compatible with all mobile CPU architectures.发生这种情况的原因是您生成的 APK 可能不兼容所有移动 CPU 架构。 By CPU architectures, I mean that some APKs are compatible with only ARM or x86 Android devices. CPU 架构是指某些 APK 仅与 ARM 或 x86 Android 设备兼容。 Therefore, there is a tag within the app-level gradle file within <project_dircectory>/android/app/build.gradle called universalApk which has to be set to true so that when you generate the APK from either android studio or from the CLI, it will generate for you a universal APK, compatible with all CPU architectures and therefore, multiple Android devices regardless of which CPU architecture that Android device supports.因此,在<project_dircectory>/android/app/build.gradle中的应用程序级 gradle 文件中有一个名为universalApk的标签,必须将其设置为 true,这样当您从 android 工作室或 CLI 生成 APK 时,它将为您生成一个通用 APK,与所有 CPU 架构兼容,因此,无论 Android 设备支持哪种 CPU 架构,都可以生成多个 Android 设备。

The parameter universalApk can be found specifically in the splits JSON object with the build.gradle file aforementioned like so:参数universalApk可以在JSON object和build.gradle文件中找到,如下所示:

 splits { abi { reset() enable enableSePerCPUArchitecture universalApk true // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } }

You can also customize, as you see in the same JSON object, the different CPU architecture you would like to include to separately support when generating an APK.您还可以自定义,如您在同一 JSON object 中看到的,您希望包含的不同 CPU 架构在生成 APK 时单独支持。 In this case, I have included: "armeabi-v7a", "x86", "arm64-v8a", "x86_64", which means when I undergo the APK generation process, a separate APK will be generated for each of these CPU architectures (which is useful is you only want to support specific android devices and reduce the size of the APK).在这种情况下,我包括了:“armeabi-v7a”、“x86”、“arm64-v8a”、“x86_64”,这意味着当我进行 APK 生成过程时,将为每个 CPU 架构生成一个单独的 APK (有用的是您只想支持特定的 android 设备并减小 APK 的大小)。

Evidently, one downside of using a Universal APK is that the size of the apk will be substantially larger than the individual architecture APKs, simply because we are accommodating multiple Android devices.显然,使用通用 APK 的一个缺点是 apk 的大小将大大大于单个架构 APK,这仅仅是因为我们要容纳多个 Android 设备。

In summary, this is the solution I found because initially, I had only uploaded the x86 APK, which produced the same error on my Android device because it was not x86 compatible.总之,这是我找到的解决方案,因为最初我只上传了 x86 APK,它在我的 Android 设备上产生了同样的错误,因为它不兼容 x86。 As soon as I generated a universal release APK via Android studio, and invited myself to test the app on my Android device using Firebase App Distribution, it worked smoothly!一旦我通过 Android 工作室生成了一个通用版本的 APK,并邀请自己使用 Firebase App Distribution 在我的 Android 设备上测试该应用程序,它运行顺利!

As for my case, when I did ./gradlew appDistributionUploadDebug , it just grabbed whatever APK file it found and uploaded it.至于我的情况,当我./gradlew appDistributionUploadDebug时,它只是抓取了它找到并上传的任何 APK 文件。 In other words, it just uploaded a portion of the app that happened to be there, which was significantly smaller than what it should have been.换句话说,它只是上传了恰好在那里的应用程序的一部分,这比它本来应该的要小得多。

./gradlew assembleDebug; ./gradlew appDistributionUploadDebug ./gradlew assembleDebug; ./gradlew appDistributionUploadDebug solved the problem. ./gradlew assembleDebug; ./gradlew appDistributionUploadDebug解决了这个问题。

After trying all of the other solutions, it turned out that the problem in my case was that there wasn't enough available storage space - the package installer gives a generic "Install failed" in this case too.在尝试了所有其他解决方案后,我发现问题在于没有足够的可用存储空间 - package 安装程序在这种情况下也给出了通用的“安装失败”。 Hopefully this saves someone else the hours I wasted.希望这可以节省其他人我浪费的时间。

I have ran into this issue.我遇到了这个问题。 This might be due to lack of sufficient space on the phone's internal storage.这可能是由于手机内部存储空间不足。 I tried freeing up some space and then installed the app.我尝试释放一些空间,然后安装该应用程序。 This worked for me.这对我有用。

We ran into this error when having the production build of our application available on the devices in question.当我们的应用程序的生产版本在相关设备上可用时,我们遇到了这个错误。

Simply uninstalling the production app worked a charm - we could then install either our test/dev/both applications without any issues.简单地卸载生产应用程序就很有吸引力——然后我们可以安装我们的测试/开发/两个应用程序而没有任何问题。

For me, bitrise had an issue with the ANDROID KEYSTORE FILE in code signing.对我来说,bitrise 在代码签名中遇到了 ANDROID KEYSTORE FILE 的问题。 Somehow, the keystore password, alias, and private upload key were missing.不知何故,缺少密钥库密码、别名和私有上传密钥。

Going to workflows -> code signing -> android keystore file and re-entering the values made it work转到工作流-> 代码签名-> android 密钥库文件并重新输入值使其工作

For me the debug apk does not work with Firebase App Distribution but release apk does work.对我来说,调试 apk 不适用于 Firebase App Distribution 但发布 apk 确实有效。 You can disable proguard in build.gradle file:您可以在build.gradle文件中禁用 proguard:

buildTypes {
    release {
        minifyEnabled false
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM