【问题标题】:How to add Crashlytics to the new architecture sample by Google如何将 Crashlytics 添加到 Google 的新架构示例中
【发布时间】:2023-01-11 16:40:10
【问题描述】:

我正在使用 google 的架构模板开始一个新项目 (https://github.com/android/architecture-templates)

在此模板中,他们将 Gradle 与 Kotlin DSL 结合使用。我正在尝试将 Crashlytics 添加到该项目中,但 gradle 的结构与我的旧项目有很大不同。

我卡在基本指南的第 2 步 (Firebase Get Started Documentation)

解析插件时出错 [id: 'com.android.application', version: '7.3.1']

无法满足对该插件的请求,因为该插件已经在未知版本的类路径中,因此 无法检查兼容性。

有什么建议吗?

【问题讨论】:

    标签: android firebase gradle-kotlin-dsl


    【解决方案1】:

    我曾经也对此感到困惑,但经过一些尝试,我找到了正确的答案。
    我认为这是您感到困惑的第 2 步的第一点。只需在项目级build.gradle的顶部添加如下代码:

    buildscript {
        dependencies {
            classpath 'com.google.gms:google-services:4.3.14'
        }
    }
    

    只需按照谷歌指南进行其余操作即可。

    完整代码:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        dependencies {
            classpath 'com.google.gms:google-services:4.3.14'
        }
    }
    
    plugins {
        id 'com.android.application' version '7.2.2' apply false
        id 'com.android.library' version '7.2.2' apply false
        id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    【讨论】:

      猜你喜欢
      • 2015-08-26
      • 1970-01-01
      • 1970-01-01
      • 2020-09-13
      • 2022-12-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-24
      • 2018-05-25
      相关资源
      最近更新 更多