android - 无法使用 android MoPub sdk gradle 初始化 Fabric

标签 android android-studio libgdx mopub

我正在尝试将 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/

相关文章:

android - 为 Objective-c 和 java 函数创建一个 dll

android - 很长的 gradle 构建时间 - Android

Android Studio - Windows 7 上的 Android SDK 问题

android - 使用HmsMessageService(HMS推送套件)无法在华为设备上获取通知

java - Android O 通知 LED setLights() 已弃用,setLightColor() 带有闪烁?

java - 无法让 ActionBar 在 Android 项目中工作并且 Android ActionBar 示例有很多编译错误

java - 谷歌地方信息 API : place category and place information

java - Android Studio & libGDX - android.os.* 无法实现(所有 android 都无法实现)

java - Libgdx Scene2d 进度条永远不会为空

android - 是否可以将 Google Play 游戏服务实时多人游戏集成到适用于 Android 和 iOS 的 LibGDX 中?