android - 我的 FragmentActivity 中的 ClassNotFoundException mopub

标签 android android-layout android-studio buildpath mopub

我正在尝试将 mopub 添加到我的应用程序中。我通过 AndroidStudio 插件安装了 sdk。并将其添加到我的 xml

 <com.mopub.mobileads.mopubview
   android:id="@+id/adview"
    android:layout_alignParentBottom="true"
    android:layout_width="fill_parent"
    android:layout_height="50dp">
</com.mopub.mobileads.mopubview>

但它给了我这些错误:

The following classes could not be found:
- com.mopub.mobileads.mopubview (Fix Build Path, Create Class)

当我运行应用程序时它崩溃了:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hroshandel.myapplication/com.example.hroshandel.myapplication.SimpleIntro_FragmentActivity}: android.view.InflateException: Binary XML file line #15: Error inflating class com.mopub.mobileads.mopubview

Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class com.mopub.mobileads.mopubview

at com.example.hroshandel.myapplication.SimpleIntro_FragmentActivity.onCreate(SimpleIntro_FragmentActivity.java:20)

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mopub.mobileads.mopubview" on path: DexPathList[[zip file "/data/app/com.example.hroshandel.myapplication-4.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.hroshandel.myapplication-4, /vendor/lib, /system/lib]]

最佳答案

请检查类名的错别字,天才写在文档中:

<com.mopub.mobileads.mopubview
   android:id="@+id/adview"
    android:layout_alignParentBottom="true"
    android:layout_width="fill_parent"
    android:layout_height="50dp">
</com.mopub.mobileads.mopubview>

但是正确的类名是:

    <com.mopub.mobileads.MoPubView> ... </com.mopub.mobileads.MoPubView>

关于android - 我的 FragmentActivity 中的 ClassNotFoundException mopub,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27330635/

相关文章:

linux - Antergos Linux 上的 "OPENSSL_1.0.0 not found"

c# - 如何在运行时在 Xamarin Android 中执行 C# 代码?

android - ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS 对部分 Android 10 设备没有影响

android - 如何在可扩展内容 RelativeLayout 中绘制垂直线

android - onResume 后应用程序崩溃

java - 错误 :duplicate files during packaging of APK Android Studio Error

android - 在 Android 的 body() 方法中改造返回 null

Android:我调用 canvas.scale() 后文本变得模糊

android - 设计 View 中底部导航的实时 View 不显示图标和菜单资源

android - EditText 的子类看起来与 Android 4 上的普通 EditText 不同