我正在尝试将Revmob广告添加到我的应用中,但我收到了ClassNotFoundException。使用他们最新的sdk,按照他们在文档上的所有步骤。 这是我的Logcat
08-08 12:50:43.122: E/AndroidRuntime(17750): java.lang.NoClassDefFoundError: com.revmob.RevMob
08-08 12:50:43.122: E/AndroidRuntime(17750): at com.mobileappsgallery.selenagomez.Photo_Booth_Activity.DeclareControls(Photo_Booth_Activity.java:86)
08-08 12:50:43.122: E/AndroidRuntime(17750): at com.mobileappsgallery.selenagomez.Photo_Booth_Activity.onCreate(Photo_Booth_Activity.java:59)
08-08 12:50:43.122: E/AndroidRuntime(17750): at android.app.Activity.performCreate(Activity.java:5231)
08-08 12:50:43.122: E/AndroidRuntime(17750): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
08-08 12:50:43.122: E/AndroidRuntime(17750): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
08-08 12:50:43.122: E/AndroidRuntime(17750): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
08-08 12:50:43.122: E/AndroidRuntime(17750): at android.app.ActivityThread.access$800(ActivityThread.java:135)
08-08 12:50:43.122: E/AndroidRuntime(17750): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
08-08 12:50:43.122: E/AndroidRuntime(17750): at android.os.Handler.dispatchMessage(Handler.java:102)
08-08 12:50:43.122: E/AndroidRuntime(17750): at android.os.Looper.loop(Looper.java:136)
08-08 12:50:43.122: E/AndroidRuntime(17750): at android.app.ActivityThread.main(ActivityThread.java:5001)
08-08 12:50:43.122: E/AndroidRuntime(17750): at java.lang.reflect.Method.invokeNative(Native Method)
08-08 12:50:43.122: E/AndroidRuntime(17750): at java.lang.reflect.Method.invoke(Method.java:515)
08-08 12:50:43.122: E/AndroidRuntime(17750): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
08-08 12:50:43.122: E/AndroidRuntime(17750): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
08-08 12:50:43.122: E/AndroidRuntime(17750): at dalvik.system.NativeStart.main(Native Method)
我的Actvity
RevMob revmob = RevMob.start(this);
RevMobBanner banner = revmob.createBanner(this);
ViewGroup view = (ViewGroup) findViewById(R.id.banner);
view.addView(banner);
清单
<meta-data
android:name="com.revmob.app.id"
android:value="@string/revmob_id" />
<activity
android:name="com.revmob.ads.fullscreen.FullscreenActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.Translucent" >
</activity>
Layout.xml
<LinearLayout
android:orientation="horizontal"
android:id="@+id/banner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
谢谢
答案 0 :(得分:0)
解决了我的问题。由于某些原因,revmob sdk需要Android支持v4库。添加库解决了这个问题。如果有人能对此作出解释,我很乐意接受他/她的回答是正确的。