Error - The import com.google.android.gms.ads cann

2019-07-22 03:41发布

问题:

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

回答1:

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...



回答2:

  • 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.


回答3:

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



回答4:

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.