【问题标题】:Gradle exception while integrating srtipe in flutter app在颤振应用程序中集成 srtipe 时出现 Gradle 异常
【发布时间】:2019-09-12 13:55:02
【问题描述】:

我正在开发一个已经集成了 firebase 的颤振应用程序。

当我为条纹添加颤振包并运行应用程序时,我得到了 gradle 异常。

应用构建.gradle


android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        applicationId "com.lab.murtuza.qualvet"
        minSdkVersion 19
        targetSdkVersion 28
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}


dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

    implementation 'com.google.firebase:firebase-analytics:17.0.1'
    implementation 'com.google.firebase:firebase-firestore:21.0.0'
    implementation 'com.google.firebase:firebase-auth:19.0.0'
    implementation 'com.google.firebase:firebase-storage:19.0.1'

    implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'

build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

FAILURE:构建失败并出现异常。

出了什么问题: 无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系。 在项目“应用程序”中,已解决的 Google Play 服务库依赖项依赖于另一个确切版本(例如“[1.3.1 ,2.3]",但未解析为该版本。库表现出的行为将是未知的。

Dependency failing: com.nimbusds:nimbus-jose-jwt:7.7 -> net.minidev:json-smart@[1.3.1,2.3], but json-smart version was 2
  .3.

  The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
  ifact with the issue.

  -- Project 'app' depends on project 'stripe_payment' which depends onto com.stripe:stripe-android@10.3.1
  -- Project 'app' depends onto net.minidev:json-smart@2.3
  -- Project 'app' depends onto com.stripe:stripe-3ds2-android@1.2.1
  -- Project 'app' depends onto com.nimbusds:nimbus-jose-jwt@7.7
  -- Project 'app' depends onto com.stripe:stripe-android@10.3.1

对于扩展调试信息,使用 ./gradlew --info :app:assembleDebug 从命令行执行 Gradle 以查看 dep 工件的结束路径。此错误消息来自 google-services Gradle 插件,在 https:// 报告问题 github.com/google/play-services-plugins 并通过将“googleServices { disableVersionCheck = false }”添加到您的 b 来禁用 uild.gradle 文件。

尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

在 2 秒内构建失败 完成错误:Gradle 任务 assembleDebug 失败,退出代码为 1

pubspec.yaml

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  countdown: ^0.1.0
  stripe_payment: ^0.2.1
  shared_preferences: ^0.5.3+4
  google_maps_flutter: ^0.5.21
  image: ^2.1.4
  flutter_lorem: ^1.1.0
  geoflutterfire: ^2.0.3+5
  firebase_core: ^0.4.0+1
  cloud_firestore: ^0.12.9+3
  firebase_storage: ^3.0.6
  firebase_auth: ^0.14.0+5
  fluttertoast: ^3.1.3
  location: ^2.3.5
  flutter_spinkit: "^4.0.0"
  image_picker: ^0.6.1+4

dev_dependencies:
  flutter_test:
    sdk: flutter

请帮我修复这个错误。

【问题讨论】:

  • 请同时粘贴您的 pubspec.yaml 依赖项
  • 已添加,请查看
  • 您对这个问题的最终解决方案是什么?我现在遇到了这个

标签: android-studio gradle flutter dart stripe-payments


【解决方案1】:

我认为,那次失败与gradle 无关。所有这些依赖项都在您的 pubspec 文件中,您可以在日志中看到。

您可以尝试做的第一件事 - 在此处检查所有这些依赖项 https://pub.dev/ 并将它们设置为最新版本。

如果这没有帮助 - 我无法为您提供 100% 的解决方案。当我遇到这样的问题时 - 我只是尝试降级冲突依赖的版本并尝试重建项目(您可以在同一站点查看所有以前的版本https://pub.dev/)。

实际上,我在pubspec 中没有看到com.nimbusds:nimbus-jose-jwt 依赖项,所以它必须在gradle 文件中而不是在您的文件中。您的某些 pubspec 依赖项包含本机代码。

您可以通过查看 Android Studio 的左侧来探索您的依赖关系 - 在树中 External libraries -> Flutter plugins

【讨论】:

  • 哦,好吧,我会尽力让你知道的。谢谢
猜你喜欢
  • 1970-01-01
  • 2022-01-16
  • 2020-03-15
  • 2021-06-18
  • 2022-01-25
  • 2019-01-18
  • 2019-11-06
  • 2020-07-23
  • 2021-04-15
相关资源
最近更新 更多