1

I have a small Android app which uses AdMob. It has been working fine for a while. Recently, I tried to add some new features, and at the same time to upgrade all used libraries to most recent version. But I have a problem with AdMobs. I did put

implementation 'com.google.android.gms:play-services-ads:15.0.1'

into app build.gradle,

maven { url "https://maven.google.com" }

into project build.gradle, add changes to manfest file(ass suggested by Google developers site), did couple of Clean/Build and Invalidate Caches/Restart, checked SDK manager for Google Play services, all with no result, AndroidStudio can't resolve com.google.android.gms.ads.MobileAds and other AdMobs classes. For all statments like

import com.google.android.gms.ads.MobileAds;

AndroidStudio marks as unsolvable e.g "Cannot resolve symbol 'MobileAds' ".

What is more confusing, the app can be built and deployed, Gradle says no errors, the app works fine and the ads are displayed as wanted. But, there are some warnings in the Logcat such as:

  • 'W/Ads: #004 The webview is destroyed. Ignoring action.',
  • ...the Google Mobile Ads SDK will not integrate with Firebase (though I don't want to integrate it with Firebase)

etc.

Therefore, I cannot publish the upgraded app without being sure it functions the way I expect.

My working environment is Linux/Fedora27, AndroidStudio 3.1.4, and as virtual device I use Genymotion 2.12.2.

2 Answers 2

2

I think I've solved it.

Somehow I figured it is ItelliJ Idea issue, so I've searched around, found some similar topics that have given me a clue. And it worked.

There is a hidden folder below project folder called .idea. And libraries folder below. Full of .xml files gradle made through build process. And I deleted them all!.

Restarted Android Studio and everything went well. So, go to

<Project>/.idea/libraries

and delete all it's content. I believe that some gradle versions incompatibilites caused the trouble. Clean and/or Invalidate Cache are not sufficient, so brutal delete is the solution.

0

If you use Android Studio.

press shift key twice. then search "cache" and run "Invalidate Caches / Restart..."

Not the answer you're looking for? Browse other questions tagged or ask your own question.