我試圖在IntelliJ Idea中將google play服務添加到我的libGDX項目中。我按照設置指南在這裏:https://developers.google.com/android/guides/setup無法解決:com.google.android.gms:在IntelliJ Idea中使用gradle播放服務
這看起來非常簡單。我只是說那行我在相應部分的build.gradle,這樣的事情現在看起來像:
project(":android") {
apply plugin: "android"
apply plugin: 'com.android.application'
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
compile 'com.google.android.gms:play-services:11.2.0'
}
}
然後我嘗試同步我的想法gradle這個項目只是爲了得到那個「無法解析」錯誤。
那麼,安裝指南還說:「確保每次更新Google Play服務時都更新此版本號」,但問題在於它幾乎不可能找到該版本號:我的Google Play服務SDK版本到Android SDK管理器是「43」,到目前爲止,我一直無法關聯這樣的「11.2.0」或任何典型的版本字符串與「43」版本號。並不是說安裝指南對此沒有提到。
無論如何,我已經嘗試了很多與此相關的問題無濟於事。具體來說,我要指出的是,我有我的Android SDK及時更新,我敢肯定,這是它正在使用的理念一(我已經三檢查這個......):
我使用API級別26,但無論如何其他定義使用Android SDK的相同目錄。此外,我沒有在這檯筆記本電腦上安裝任何其他的android SDK,所以毫無疑問,Idea只使用那一個。
任何想法都是值得歡迎的。
提前致謝!
我不明白'應用插件:「com.google.gms.google-services'' –
我沒有看到它無論是在建立谷歌播放服務指南。這是從哪裏來的? –
JFTR,用11.0.0而不是11.2.0代替版本號似乎有訣竅,但我仍然在這裏做一些測試,所以我不會將它作爲答案發布,直到我確信。 –