Search code examples
androidrevmob

Revmob ClassNotFoundException


I am trying to add Revmob ads to my app but I am getting ClassNotFoundException. Using their latest sdk, followed all their step on documentation. here is my 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)

My code in my Actvity

RevMob revmob = RevMob.start(this); 
RevMobBanner banner = revmob.createBanner(this);
ViewGroup view = (ViewGroup) findViewById(R.id.banner);
view.addView(banner);

Manifest

<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" >

Thank you


Solution

  • Solved my problem. For some reasons the revmob sdk requires Android support v4 library. Adding the library solved the problem. If someone could give explanation for this I would gladly accept his/her answer as correct.