提问人:Charles Jr 提问时间:2/19/2021 最后编辑:Charles Jr 更新时间:7/28/2021 访问量:628
Flutter Android 构建无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系 Google Play 服务错误
Flutter Android build Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' Google Play Services Error
问:
我正在运行一个 flutter 项目,但遇到一个持续错误,涉及 Google Play 服务版本控制以及onesignal_flutter依赖项。我已经找到了一些 react 的答案,但没有找到 Flutter。请帮忙。
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:[email protected]
-- 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:[email protected]
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
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
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
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
答:
0赞
Isuru devinda de silva
7/28/2021
#1
显然将 gradle-wrapper.properties 中的 distributionUrl 从
distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip
自
distributionUrl=https://services.gradle.org/distributions/gradle-6.5-bin.zip
工程。
评论