-3

I am trying to modify an app and the following error came out when I have done a robo test from Firebase console

java.lang.NoClassDefFoundError: com.google.android.gms.ads.AdRequest$Builder




FATAL EXCEPTION: main
 Process: com.vasu.VFB, PID: 8929
 java.lang.NoClassDefFoundError: com.google.android.gms.ads.AdRequest$Builder
    at com.vasu.VFB.MainActivity.onCreate(MainActivity.java:176)
    at android.app.Activity.performCreate(Activity.java:5451)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2377)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
    at android.app.ActivityThread.access$900(ActivityThread.java:175)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5602)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
    at dalvik.system.NativeStart.main(Native Method)

You can check the screenshot and video from below links :

https://storage.cloud.google.com/test-lab-txya7zxdd57fx-iz4c6j326k3j4/web-build_2017-03-28T11:02:23.163Z_WCLo/t03g-19-en_US-portrait/artifacts/ebd75c76.png

You can also download app from here http://www47.zippyshare.com/v/wdVCqNb5/file.html

halfer
  • 19,471
  • 17
  • 87
  • 173

3 Answers3

0

Try adding these 3 lines in your app/build.gradle

compile "com.google.android.gms:play-services:8.4.0"
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'

Either you are missing library for com.google.android.gms.ads.AdRequest$Builder.

Please add corresponding gradle dependency.

compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.google.android.gms:play-services-ads:7.8.0'

OR

You have signed apk which removes these classes after obfuscation. Please update proguard-rules to keep these classes

-keep class com.google.android.gms.** { *; }

OR

Google play services version doesn't match. Please use matching Google Play services lib.

PEHLAJ
  • 9,590
  • 9
  • 39
  • 51
0

In your build.gradle, check that your version level for firebase is the same as the version level for google services.

compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'

compile 'com.google.firebase:firebase-appindexing:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'
ndelanou
  • 111
  • 2
  • 12
0

For this the answer is simple...

Your Google PlayServices SDK is updated & the com.google.android.gms.ads.AdRequest$Builder is not available in that library.

If you add the old google play services library that must pass..

Takermania
  • 1,325
  • 2
  • 12
  • 20