我正在尝试将 MoPub SDK 添加到我的 libgdx 游戏中。我使用了似乎有效的 gradle 集成。但是,我无法为 Fabric 提供新的 MoPub() 对象。我使用 android studio 1.2.1.1。并遵循 https://github.com/mopub/mopub-android-sdk 的要求
Fabric.with(this, new Crashlytics(), new MoPub());
在andoid studio中返回:
Error:(89, 15) error: method with in class Fabric cannot be applied to given types;
required: Context,Kit[]
found: AndroidLauncher,Crashlytics,MoPub
reason: varargs mismatch; MoPub cannot be converted to Kit
由于某种原因,MoPub 对象未被识别为正确的类型。我不明白为什么。
这是我的 gradle 文件的样子:
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
configurations { natives }
dependencies {
compile project(":core")
compile files('libs/mopub-volley-1.1.0.jar')
compile files('libs/android-support-v7-recyclerview.jar')
compile files('libs/annotations-4.1.1.4.jar')
compile files('libs/android-support-v4.jar')
compile('com.mopub:mopub-sdk:4.0.0@aar') {
transitive = true
}
compile('com.crashlytics.sdk.android:crashlytics:2.2.2@aar') {
transitive = true;
}
最佳答案
MoPub 不是套件(不扩展套件)。您无需将其添加到您的 Fabric.with() 调用中。只要您的权限和依赖关系正确,您就可以开始使用它。重申;只是改变这个:
Fabric.with(this, new Crashlytics(), new MoPub());
为此:
Fabric.with(this, new Crashlytics());
请注意,我假设 this
是一个有效的 Context 对象。
关于android - 无法使用 android MoPub sdk gradle 初始化 Fabric,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33396828/