简体   繁体   English

Flutter Android build 无法确定任务“:app:compileDebugJavaWithJavac”的依赖项 Google Play 服务错误

[英]Flutter Android build Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' Google Play Services Error

I'm running a flutter project and I'm getting a persistent error involving Google Play Services versioning along with onesignal_flutter dependencies.我正在运行 flutter 项目,并且遇到涉及 Google Play 服务版本控制以及 onesignal_flutter 依赖项的持续错误。 I've found a few answers for react but not Flutter.我找到了一些反应的答案,但不是 Flutter。 Please help.请帮忙。

    FAILURE: Build failed with an exception.
        
        * What went wrong:
        Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
        > In project 'app' a

 resolved Google Play services library dependency depends on another at an exact version (e.g. "[10.2.
      1, 16.0.99]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
    
      Dependency failing: com.onesignal:OneSignal:3.15.6 -> com.google.android.gms:play-services-location@[10.2.1, 16.0.99], b
      ut play-services-location version was 15.0.1.
    
      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 onto com.google.android.gms:play-services-location@{strictly 15.0.1}
      -- Project 'app' depends on project 'onesignal_flutter' which depends onto com.onesignal:OneSignal@3.15.6
      -- Project 'app' depends onto com.onesignal:OneSignal@{strictly 3.15.6}
      -- Project 'app' depends onto com.google.android.gms:play-services-location@[10.2.1, 16.0.99]
      -- Project 'app' depends onto com.onesignal:OneSignal@{strictly 3.7.0}
      -- Project 'app' depends onto com.google.android.gms:play-services-location@15.0.1
    
      For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
      endency paths to the artifact. This error message came from the strict-version-matcher-plugin Gradle plugin, report issu
      es at https://github.com/google/play-services-plugins and disable by removing the reference to the plugin ("apply 'stric
      t-version-matcher-plugin'") from build.gradle.

Pubsec.yaml Pubsec.yaml

name: myfavkpop_example
description: Demonstrates how to use the myfavkpop plugin.
publish_to: 'none'
version: 1.0.1+10

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  firebase_database: ^4.3.0
  firebase_auth: ^0.18.3
  firebase_admob: ^0.10.2
  firebase_storage: ^5.0.1
  google_sign_in: ^4.5.6
  path_provider: ^1.6.21
  onesignal_flutter: ^2.6.2
  flutter_native_admob: ^2.1.0+3
  flutter_facebook_auth: ^1.0.0
  network_image_to_byte: ^0.0.1
  cached_network_image: ^2.2.0
  flutter_webview_plugin: ^0.3.11
  animated_splash: 0.0.1
  url_launcher: ^5.4.7
  image_picker: ^0.6.7+12
  http: ^0.12.2
  collection: ^1.15.0-nullsafety.3

  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.0
  flutter_launcher_icons: ^0.8.1


dev_dependencies:
  flutter_test:
    sdk: flutter

  myfavkpop:
    path: ../

flutter_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icon.jpeg"

app/build.gradle应用程序/build.gradle

buildscript {
    repositories {
        // ...
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
    }
    dependencies {
        // ...
        // OneSignal-Gradle-Plugin
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.10'
    }
}


def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.myfavkpop.myfavkpop_example"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            //signingConfig signingConfigs.debug
            signingConfig signingConfigs.release

            minifyEnabled true
            useProguard true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
            buildConfigField "String", "SERVER_URL", '"http://192.131.543"'

        }
    }
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }
    buildToolsVersion = '28.0.3'

    configurations.all {
        resolutionStrategy {
            force 'androidx.media:media:1.0.0'
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation 'com.google.firebase:firebase-core:18.0.2'
    testImplementation 'junit:junit:4.13.1'
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.core:core:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    api 'androidx.legacy:legacy-support-v4:1.0.0'
    //implementation 'com.onesignal:OneSignal:4.0.0'
    implementation 'com.google.android.gms:play-services-base:17.6.0'
    implementation 'com.google.android.gms:play-services-measurement-base:18.0.2'
    implementation 'com.google.android.gms:play-services-basement:17.6.0'
    implementation 'com.google.android.gms:play-services-measurement-sdk:18.0.2'
    implementation 'com.google.android.gms:play-services-location:[10.2.1, 16.0.99]'
    //implementation 'com.google.firebase:firebase-iid:21.0.1'
    //implementation 'com.google.firebase:firebase-messaging:21.0.1'
    //implementation 'com.google.firebase:firebase-common:19.5.0'
    implementation 'com.google.android.gms:play-services-tasks:17.2.1'
    implementation 'com.google.android.gms:strict-version-matcher-plugin:1.2.2'
    //implementation 'com.google.gms:google-services:4.3.5'
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.google.gms.google-services'
googleServices {
    disableVersionCheck = true
}
apply plugin: 'com.google.android.gms.strict-version-matcher-plugin'

android/build.gradle安卓/build.gradle

buildscript {
    repositories {
        google()
        jcenter()
        maven { url "https://maven.google.com" }
    }
    dependencies {
        classpath 'com.google.gms:google-services:4.3.5'
        classpath 'com.android.tools.build:gradle:3.6.4'
        classpath 'com.google.android.gms:strict-version-matcher-plugin:1.2.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
    configurations {
        all {
            resolutionStrategy {
                force "androidx.arch.core:core-runtime:2.0.0"
                force "androidx.slidingpanelayout:slidingpanelayout:1.0.0"
                force "androidx.documentfile:documentfile:1.0.0"
                force "androidx.fragment:fragment:1.0.0"
                force "androidx.core:core:1.0.0"
            }
        }
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}

subprojects {
    project.evaluationDependsOn(':app')

}

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'androidx.vectordrawable' &&
                    !details.requested.name.contains('androidx')) {
                details.useVersion "1.0.0"
            }
            if (details.requested.group == 'androidx.appcompat' &&
                    !details.requested.name.contains('androidx')) {
                details.useVersion "1.0.0"
            }
            if (details.requested.group == 'androidx.core' &&
                    !details.requested.name.contains('androidx')) {
                details.useVersion "1.0.0"
            }
            if (details.requested.group == 'androidx.support' &&
                    !details.requested.name.contains('androidx')) {
                details.useVersion "1.0.0"
            }
            if (details.requested.group == 'com.android.support' &&
                    !details.requested.name.contains('androidx') ) {
                details.useVersion "1.0.0"
            }
            if (details.requested.group == 'androidx.admob' &&
                    !details.requested.name.contains('androidx') ) {
                details.useVersion "1.0.0"
            }
            if (details.requested.group == 'androidx.browser' &&
                    !details.requested.name.contains('androidx') ) {
                details.useVersion "1.0.0"
            }
        }
    }
}

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

Apparently changing the distributionUrl in the gradle-wrapper.properties from显然将 gradle-wrapper.properties 中的 distributionUrl 从

distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip

to

distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip

works.作品。

暂无
暂无

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

相关问题 Flutter 构建错误:无法确定任务':app:compileDebugJavaWithJavac的依赖关系 - Flutter Build Error:Could not determine the dependencies of task ':app:compileDebugJavaWithJavac 无法确定任务 &#39;:app:compileDebugJavaWithJavac&#39; 的依赖关系。[Flutter] - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.[Flutter] 无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系 - Flutter - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' - Flutter 无法确定任务 ':app:compileDebugJavaWithJavac' Flutter 的依赖关系 - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' Flutter flutter 错误无法确定任务':app:compileDebugJavaWithJavac'的依赖关系 - flutter error Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' 错误:无法确定任务&#39;:app:compileDebugJavaWithJavac&#39;的依赖关系 - Error:Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' 错误=&gt;无法确定任务&#39;:app:compileDebugJavaWithJavac&#39;的依赖关系 - Error=> Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' 无法确定任务“:app:compileDebugJavaWithJavac”的依赖关系。 - 颤振问题 - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. - Flutter Issue flutter run 无法确定任务&#39;:app:compileDebugJavaWithJavac&#39;的依赖关系 - flutter run Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' Flutter 通知 OneSignal - 无法确定任务 &#39;:app:compileDebugJavaWithJavac&#39; 的依赖关系 - Flutter Notification OneSignal - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM