我有一个应用程序,我有
public class mainactivity extends Activity implements View.OnClickListener
{
...
我在那个清单中宣布它。一切都编译完美。然后我按如下方式更改课程:
public class mainactivity extends Activity implements View.OnClickListener , MoPubInterstitialListener
{
...
+ extra code to do with "mopub"
这个新代码编译,但是现在,只要我的启动画面活动关闭并移交到mainactivity,我就会看到
03-08 10:47:40.380: I/dalvikvm(9013): Failed resolving Lcom/mycompany/myapp/mainactivity; interface 1127 'Lcom/mopub/mobileads/MoPubInterstitial$MoPubInterstitialListener;'
03-08 10:47:40.380: W/dalvikvm(9013): Link of class 'Lcom/mycompany/myapp/mainactivity;' failed
03-08 10:47:40.380: D/AndroidRuntime(9013): Shutting down VM
03-08 10:47:40.380: W/dalvikvm(9013): threadid=1: thread exiting with uncaught exception (group=0x40c7e1f8)
03-08 10:47:40.385: E/AndroidRuntime(9013): FATAL EXCEPTION: main
03-08 10:47:40.385: E/AndroidRuntime(9013): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mycompany.myapp/com.mycompany.myapp.mainactivity}: java.lang.ClassNotFoundException: com.mycompany.myapp.mainactivity
03-08 10:47:40.385: E/AndroidRuntime(9013): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1891)
03-08 10:47:40.385: E/AndroidRuntime(9013): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
03-08 10:47:40.385: E/AndroidRuntime(9013): at android.app.ActivityThread.access$600(ActivityThread.java:127)
03-08 10:47:40.385: E/AndroidRuntime(9013): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
03-08 10:47:40.385: E/AndroidRuntime(9013): at android.os.Handler.dispatchMessage(Handler.java:99)
03-08 10:47:40.385: E/AndroidRuntime(9013): at android.os.Looper.loop(Looper.java:137)
03-08 10:47:40.385: E/AndroidRuntime(9013): at android.app.ActivityThread.main(ActivityThread.java:4511)
03-08 10:47:40.385: E/AndroidRuntime(9013): at java.lang.reflect.Method.invokeNative(Native Method)
03-08 10:47:40.385: E/AndroidRuntime(9013): at java.lang.reflect.Method.invoke(Method.java:511)
03-08 10:47:40.385: E/AndroidRuntime(9013): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
03-08 10:47:40.385: E/AndroidRuntime(9013): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
03-08 10:47:40.385: E/AndroidRuntime(9013): at dalvik.system.NativeStart.main(Native Method)
03-08 10:47:40.385: E/AndroidRuntime(9013): Caused by: java.lang.ClassNotFoundException: com.mycompany.myapp.mainactivity
03-08 10:47:40.385: E/AndroidRuntime(9013): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
03-08 10:47:40.385: E/AndroidRuntime(9013): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-08 10:47:40.385: E/AndroidRuntime(9013): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-08 10:47:40.385: E/AndroidRuntime(9013): at android.app.Instrumentation.newActivity(Instrumentation.java:1026)
03-08 10:47:40.385: E/AndroidRuntime(9013): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1882)
03-08 10:47:40.385: E/AndroidRuntime(9013): ... 11 more
我不知道如何继续。如果我尝试调试器,它似乎甚至不会执行mainactivity.OnCreate()的第一行。
编辑:我的清单中包含以下内容:
<activity android:name="com.mopub.mobileads.MoPubActivity"
android:configChanges="keyboardHidden|orientation"/>
答案 0 :(得分:1)
如果响铃,请继续阅读。
的诊断:强>
这意味着编译器在compile-time
期间找到这些类,但在runtime
的医学:强>
我之前已经有了这个,并且我不完全确定这些步骤,但是 让我把你放在正确的方向上。
.classpath
。如果ComponentInfo
是库项目的一部分,那么它是CardinalSin
(严重!)手动将其包含在您的构建路径中。您 应该 只需添加project properties->android
标签中的库项目。
答案 1 :(得分:0)
您是否在Manifest中定义了MoPub活动?
<activity android:name="com.mopub.mobileads.MoPubActivity"
android:configChanges="keyboardHidden|orientation"/>
去查看this链接。它应该可以解决你的问题。
答案 2 :(得分:0)
我有一个类似的问题,我检查了Java Build Path - Order and Export下的android-support-v4.jar复选框。