将firebase_storage包含在flutter应用程序中的最佳方法是什么?

问题描述 投票:0回答:1

我需要在Firebase中存储几个文件。我正在使用android模拟器。问题是:当我将包包含在yaml(firebase_storage)中时,我遇到了一个很大的错误:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not resolve com.google.firebase:firebase-storage:16.0.3.
  Required by:
      project :app > project :firebase_storage
   > Could not resolve com.google.firebase:firebase-storage:16.0.3.
      > Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-storage/16.0.3/firebase-storage-16.0.3.pom'.
         > Could not GET 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-storage/16.0.3/firebase-storage-16.0.3.pom'.
            > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.google.firebase:firebase-storage:16.0.3.
      > Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-storage/16.0.3/firebase-storage-16.0.3.pom'.
         > Could not GET 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-storage/16.0.3/firebase-storage-16.0.3.pom'.
            > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.google.firebase:firebase-storage:16.0.3.
      > Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-storage/16.0.3/firebase-storage-16.0.3.pom'.
         > Could not GET 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-storage/16.0.3/firebase-storage-16.0.3.pom'.
            > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
   > Could not resolve com.google.firebase:firebase-storage:16.0.3.
      > Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-storage/16.0.3/firebase-storage-16.0.3.pom'.
         > Could not GET 'https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-storage/16.0.3/firebase-storage-16.0.3.pom'.
            > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run
with --scan to get full insights.

* Get more help at https://help.gradle.org

我按照google firebase官方页面给出的步骤尝试在我的flutter项目中设置一个firebase项目。我尝试将此代码添加到我的android / gradle中:

subprojects{
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
            && !details.requested.name.contains('multidex')) {
                details.useVersion "26.1.0"
            }
        }
    }
}

目前,由于这个原因,我无法运行我的应用程序。我想知道在firebase中存储文件的最有效方法是什么。

firebase flutter firebase-storage
1个回答
0
投票

如果您错过了一个步骤,请考虑遵循此codelab,或阅读here。 (google-services.json或SHA键等)

如果你已经完成了设置,它可能与AndroidX有关。

当您检查changelog.md时,您会看到版本0.9.0的重大更改。

enter image description here

尝试使用previous packagesmigrate将项目安装到AndroidX来避免使用AndroidX。

© www.soinside.com 2019 - 2024. All rights reserved.