简体   繁体   中英

Error - The import com.google.android.gms.ads cannot be resolved

I follow instruction from Google developpers but i have a problem. I want display publicity ( with AdMob ) and Google Play Game services on my application.

I display publicity with success and it's work ( I use google play services lib ). But when I want to add the BaseGameUtils library to use Google Play Game Services, I have an error.

My import which work previously doesn't works after the new library import.

The import com.google.android.gms.ads cannot be resolved

I don't remove google play services lib so why the error appears ?

Thanks

Go to your java build path, under project tab add your lib and then under order & export tab tick your lib, apply settings. At last just clean the project and lib, it should work properly...

  • First solution: Right click error and select the Fix project setup like below image.在此处输入图片说明

  • Select google-play-service.jar right path and click ok

在此处输入图片说明

  • Second solution: Delete android-support-v4.jar file under libs folder after restart eclipse.

Change the version of the library in the build.gradle(:app) file to

"com.google.android.gms:play-services-ads:19.2.0".

This did the trick for me

Make sure that your library is in your build path. I had the same problem with another lib.

I solved this error by downloading the latest version (15 as of today) of the Google Play Services. Then import it again as a library in your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM