Tuesday, July 19, 2011

Android AdMob & ProGuard

On most devices, using AdMob in an obfuscated application (using ProGuard) works perfectly fine. However, on a few devices (I don't know which ones), you'll get a java.lang.NoSuchMethodError and your users will be angry. Here's the full stack trace: java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:200) at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) at java.util.concurrent.FutureTask.setException(FutureTask.java:124) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) at java.util.concurrent.FutureTask.run(FutureTask.java:137) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561) at java.lang.Thread.run(Thread.java:1102) Caused by: java.lang.NoSuchMethodError: com.google.gson.Gson.a at c.a(Unknown Source) at c.doInBackground(Unknown Source) at android.os.AsyncTask$2.call(AsyncTask.java:185) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) ... 4 more When I first got this report I quickly realized it wasn't my fault, since I don't use gson. To cut to the chase, here's what I put in my procfg.txt to fix it (at least for now): -keep public class com.google.ads.** { public protected *; } -keep public class com.google.gson.** { public protected *; }


  1. Thanks. I'm no trouble with this for now, but I prefer to prevent..

  2. Thanks, I'm in trouble with this right now and I prefer this knowledge ..

  3. oh god!! very very very veryvery veryvery veryvery very thank you ㅠㅠ

  4. Thanks man.
    I too don't use Gson :)

  5. Your topic was great! Thanks for taking a moment to draft such an interesting piece… Application Development using Angularjs

  6. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    python training in pune | python training institute in chennai | python training in Bangalore

  7. Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up. 
    Devops Training courses
    Devops Training in Bangalore
    Best Devops Training in pune
    Devops interview questions and answers

  8. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
    Java training in Chennai | Java training in Bangalore

    Java online training | Java training in Pune

  9. It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command

    Data Science Course in Indira nagar | Data Science Course in Electronic city

    Python course in Kalyan nagar | Data Science course in Indira nagar

    Data Science Course in Marathahalli | Data Science Course in BTM Layout

  10. This comment has been removed by the author.

  11. Thanks for such a great article here. I was searching for something like this for quite a long time and at last, I’ve found it on your blog. It was definitely interesting for me to read about their market situation nowadays.AngularJS Training in Chennai | Best AngularJS Training Institute in Chennai |

  12. Wow!! Really a nice Article. Thank you so much for your efforts. Definitely, it will be helpful for others. I would like to follow your blog. Share more like this. Thanks Again.
    iot training in Chennai | Best iot Training Institute in Chennai

  13. This comment has been removed by the author.

  14. Your article increases the curiosity to learn more about this topic. Keep sharing your information regularly for future reference.
    Devops Training in Chennai | Devops Training Institute in Chennai

  15. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.

    devops online training

    aws online training

    data science with python online training

    data science online training

    rpa online training

  16. Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
    Microsoft Azure online training
    Selenium online training
    Java online training
    Python online training
    uipath online training