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

时间:2019-03-27 21:53:46

标签: firebase flutter firebase-storage

我需要在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中存储文件的最佳方法是什么。

1 个答案:

答案 0 :(得分:0)

考虑遵循此codelab,或阅读here,以防万一您错过了一步。 (google-services.json或SHA键等)

如果一切都准备就绪,则可能与AndroidX有关。

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

enter image description here

尝试使用previous packagesmigrate到AndroidX的项目来避免使用AndroidX。