ClassNotFoundException: Didn't find class “com.google.android.gms.ads.AdView”

前端 未结 3 791
花落未央
花落未央 2020-11-27 07:56

I did a lot of research and this seems to be a common error for many users but for very different reasons. None of which I found worked for me.

I\'m getting

相关标签:
3条回答
  • 2020-11-27 08:16

    I did what @user1684030 said (upgraded Android SDK Build Tools; changed compiler to 1.7), but not worked for me. I've written the solution that I found in case it could help anyone with the same problem:

    In the step 3 of Setting Up Google Play Services says:

    In your app project, reference Google Play services library project. See Referencing a Library Project for Eclipse for more information on how to do this.

    Note: You should be referencing a copy of the library that you copied to your development workspace—you should not reference the library directly from the Android SDK directory.

    Solution: Don't do the copy manually. Instead just check the box in Eclipse that says "Copy projects into workspace"

    I did it so and everything worked again.

    Thanks to this StackOverFlow question: How to fix Google Play Services 2 Library install to Eclipse (Admob is part of Google Play Services)

    0 讨论(0)
  • 2020-11-27 08:30

    I finally solved my problems by

    • installing the newest version of Android SDK Build Tools (didn't realize that I did not have them yet)
    • switching from Compiler compliance level 1.6 to 1.7 (Window - Preferences - Java - Compiler - Compiler compliance level)

    Thanks at everybody.

    0 讨论(0)
  • 2020-11-27 08:33

    This because ProGuard. To safely use ProGuard with Google Mobile Ads, add the following to your ProGuard config:

    -keep public class com.google.android.gms.ads.** {
       public *;
    }
    
    -keep public class com.google.ads.** {
       public *;
    }
    
    0 讨论(0)
提交回复
热议问题