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