![](/img/trans.png)
[英]Build error using Firebase and Geolocator (or any Swift plugin) in iOS (Flutter)
[英]Flutter OneSignal clashing with geolocator
我創建的應用程序需要 geolocator 和 onesignal,geolocator 工作正常,但 onesignal 導致以下錯誤:
* 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.12.5 -> com.google.android.gms:play-services-location@[10.2.1, 16.0.99], b
ut play-services-location version was 17.0.0.
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 'geolocator' which depends onto com.google.android.gms:play-services-location@16.0.0
-- Project 'app' depends onto com.onesignal:OneSignal@3.12.5
-- Project 'app' depends onto com.onesignal:OneSignal@{strictly 3.12.5}
-- Project 'app' depends onto com.google.android.gms:play-services-location@{strictly 17.0.0}
-- Project 'app' depends on project 'google_api_availability' which depends onto com.google.android.gms:play-services-lo
cation@17.0.0
-- Project 'app' depends on project 'onesignal_flutter' which depends onto com.onesignal:OneSignal@3.12.5
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 google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.
* 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
BUILD FAILED in 3m 5s
這是我在 build.gradle android 中為 onesignal 添加的內容:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
maven { url 'https://plugins.gradle.org/m2/'} // Gradle Plugin Portal
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
}
}
這是應用級別的 build.gradle:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.onesignal:OneSignal:[3.11.2, 3.99.99]'
api 'com.onesignal:OneSignal:3.12.5'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
這是pubspec:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
firebase_auth: ^0.15.3+1
cloud_firestore: ^0.13.0+1
provider: ^4.0.2
flutter_spinkit: ^4.1.1+1
bottom_navy_bar: ^3.0.0
contacts_service: ^0.3.9
permission_handler: ^4.0.0
spinner_input: ^0.1.2
datetime_picker_formfield: ^0.4.3
font_awesome_flutter: ^8.5.0
transformer_page_view: ^0.1.6
image_picker: ^0.6.2+3
flushbar: ^1.9.1
intl: ^0.15.5
flutter_native_timezone: ^1.0.2
timezone: ^0.5.2
simple_gesture_detector: ^0.1.3
flutter_launcher_icons: ^0.7.2+1
geolocator: ^5.1.5
synchronized: ^2.1.1
firebase_core: ^0.4.0
flutter_email_sender: ^2.2.2
onesignal_flutter: ^2.3.2
我已經制作了最小 SDK 版本 21,將 onesignal 版本更改為舊的和新的沒有任何效果。 請幫助我只是初級開發人員
將此代碼粘貼到您的應用程序級 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.6, 0.99.99]'
}
}
應用插件:'com.onesignal.androidsdk.onesignal-gradle-plugin'
改變這個:
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
進入這個:
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.