在IntelliJ IDEA的与gradle这个播放服务:没能解决:com.google.android.gms

弗兰Marzoa:

我想谷歌播放服务中的IntelliJ IDEA我libGDX项目添加。我在这里跟着安装指南:https://developers.google.com/android/guides/setup

这看起来很简单。我只是说那行我在相应部分的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这个项目只是为了得到那个“未能解决”的错误。

好了,安装指南还表示,“要确保你每次谷歌Play服务更新更新此版本号”,但问题是,它似乎几乎不可能找到的版本号:我的谷歌根据Android SDK中播放服务SDK版本经理是“43”,到目前为止,我一直无法关联这样的“11.2.0”或任何典型的版本字符串与“43”的版本号。这并不是说安装指南只字未提这一点。

反正,我已经尝试了很多东西从与此相关无济于事问题太多了。具体来说,我要指出的是,我有我的Android SDK及时更新,我敢肯定,这是它正在使用的理念一(我已经三检查这个......):

Android SDK中经理 项目结构

I'm using the API level 26, but anyway the other defines do use the very same directory for the Android SDK. Moreover, I do NOT have any other android SDK installed at all in this laptop, so there's no question about Idea being using that one and that one only.

Any ideas are more than welcome.

Thanks in advance!

Fran Marzoa :

I just replaced version 11.2.0 with 11.0.0 and then it seemed to work fine, so that had to mean that 11.2.0 wasn't included with the latest Android SDK.

So, after struggling with all the available scattered documentation, I reached this document by pure chance (I guess it is not indexed high enough by Google): https://developers.google.com/android/guides/releases

I quote from there:

Highlights from the Google Play services 11.2 release. Google Play services dependencies are now available via maven.google.com

Now, even when that shouldn't necessarily mean that they are not available with the downloaded SDK anymore, it seems that this is actually the case.

Anyway, adding google() to my build.gradle didn't work (not found, undefined, or whatever...), so I used a different approach that I found in this document referenced from the previous one:

https://developer.android.com/studio/build/dependencies.html#google-maven

I modified my build.gradle file adding that line to allprojects/repositories, as in:

allprojects {
...
    repositories {
...
        maven { url "https://maven.google.com/"}
    }
}

And then also in the android section in the same build.gradle file:

project(":android") {
...
    dependencies {
...
        compile 'com.google.android.gms:play-services-ads:11.2.0'
    }
}

Those two lines were enough to make Gradle sync without problems. I didn't need to add any plugins apart from the ones that are already added in my libGDX project by default.

After that, I got a few different errors, but none about Gradle or dependencies. In a brief, JFTR:

First, I had a minSdkVersion of 8. Solved by raising it to 14. I think I could live without supporting all those devices below 14.

Second, I had problems with the dex upper limit of references. I've never faced this problem before, but maybe you've already noticed the solution I used: instead of compiling the whole 'com.google.android.gms:play-services' I used only 'com.google.android.gms:play-services-ads' that's the API I'm actually interested right now. For those other particular cases where a solution like this may not be useful, this document could provide some better insight: https://developer.android.com/studio/build/multidex.html

Third, even after that I got this "jumbo" thing problem described and answered here: https://stackoverflow.com/a/26248495/1160360

And that's it. As of now, everything builds and my game does finally shows those Admob banners.

我花了几个小时与此,心想,这使我怀疑,如果所有我们使用这些最近的楼宇自动化系统是值得的额外负担,他们补充。

我的意思是,我第一次与AdMob五年前左右添加到应用程序,我只是下载一个.jar文件,并把它放在我的项目的目录。这是相当明显的,整个过程中,从谷歌上搜索“在我的Android项目如何设置AdMob联播”有我的应用中展示AdMob广告旗帜把我仅有几分钟的路程。我要离开这里,因为这是不适合这类辩论的地方。

尽管如此,我希望我自己的经验是有用的人别人更远。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

什么是com.google.android.gms.version?

com.google.android.gms。无法完成

无法解决Eclips错误com.google.android.gms.ads

Android GoogleAPIClient-NoClassDefFoundError:com / google / android / gms / internal / zzsa

Android 9 Pie崩溃(com.google.android.gms ... ClassNotFoundException)

如何更正GMS未捕获的异常.NoClassDefFoundError:com.google.android.gms.internal.zzno

无法解析“ com.google.android.gms.gcm.GcmReceiver”?

错误:资源数组/ com_google_android_gms_fonts_certs

com.google.android.gms.location.LocationCallback是接口还是类?

更改com.google.android.gms:play-services的版本

元素<com.google.android.gms.ads.AdView>是未知的

无法解析导入com.google.android.gms.location.ActivityRecognitionResult

导入com.google.android.gms.maps无法解析

复制类com.google.android.gms.location.places.zza

com.google.android.gms.ads.internal.video崩溃

错误包`com.google.android.gms ...`不存在

com.google.android.gms.plus.PlusOneButton已弃用

将com.google.android.gms的版本更新为15.0.2

带有com.google.android.gms的DeadObjectException

com.google.android.gms.auth.GoogleAuthException:未知

找不到类com.google.android.gms.analytics.GoogleAnalytics

必需的com.google.android.gms.GoogleMap发现无效

ClassNotFoundException com.google.android.gms.measurement.AppMeasurement

无法解析导入com.google.android.gms

找不到类com.google.android.gms.maps.SupportMapFragment

com.google.android.gms.common.api.ApiException:16:

无法解析(com.google.android.gms.location.LocationListener)

将com.google.android.gms版本更新为12.0.0

com.google.android.gms.common.api.ApiException:8: