当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Error using both AdMob and Google-Map plugins together with Ionic

问题描述:

I'm creating an Ionic app from scratch, on Windows 10, using the following instructions:

ionic start testIonic --v2

cd testIonic

ionic platform add android

ionic plugin add cordova-plugin-googlemaps

ionic plugin add cordova-admob

ionic run android

With those steps, I'm receiving the following errors at compilation:

Everything works fine if i only use one of the cordova plugins:

PS. I already tried doing the following with no success:

ionic plugin add cordova-plugin-admobpro

ionic plugin add cordova-plugin-admob

ionic plugin add admob

I've already seen both this post and this post but none of them seems to work for me.

网友答案:

According to this post: http://stackoverflow.com/a/41042556/1623180

You have to:

1.- Make sure you're running your application on an emulator with Google Play Services installed, in case you're testing your app on a physical device, this should not be the problem.

2.- Go to your SDK Manager (which you can access through Android Studio) and install the following packages: Android Support Repository, Library, Play Services and Google Repository.

3.- Go to project.properties on your ionic root folder, and update the versions both Maps and Admob are using.

To complete the last point you have to search for something like:

cordova.system.library.1=com.google.android.gms:<plugin-name>:9.2.0
cordova.system.library.1=com.google.android.gms:<plugin-name>:9.2.0

And update them to use the same version, could be +,9.20 or 9.8.0, I'd recommend using the + indicator:

cordova.system.library.1=com.google.android.gms:<plugin-name>:+
cordova.system.library.1=com.google.android.gms:<plugin-name>:+

Let us know if that solves your problem.

分享给朋友:
您可能感兴趣的文章:
随机阅读: