You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Ionic Pro中配置正确版本的play-services并完成构建

How to Set Specific Google Play Services Versions for Ionic Pro Builds

Got it, let's walk through exactly how to fix this and get your Ionic Pro builds working with the correct Play Services versions. Here's the step-by-step process:

1. Modify the project.properties file locally

First, navigate to your Ionic project's root directory. From there, go into the platforms/android folder and open the project.properties file in your favorite text editor.

Look for these two lines:

com.google.android.gms:play-services-maps:+
cordova.system.library.3=com.google.android.gms:play-services-location:+

The + sign tells Cordova to pull the latest available version, which can cause compatibility issues in Ionic Pro builds. Replace the + with a specific, stable version number that's compatible with your project (like 17.0.0—adjust this to a version that works for your plugins and target SDK). Your modified lines should look like this:

com.google.android.gms:play-services-maps:17.0.0
cordova.system.library.3=com.google.android.gms:play-services-location:17.0.0

Pro tip: Make sure both versions match! Mismatched Play Services versions are a common cause of Android build failures.

2. Commit the changes to Git

Since Ionic Pro uses Git to sync your project, you need to ensure your modification is tracked:

  • Head back to your project's root directory
  • Run git status to confirm platforms/android/project.properties shows up as a modified file
  • Stage the change with git add platforms/android/project.properties
  • Commit it with a clear message: git commit -m "Lock Google Play Services versions for Ionic Pro builds"

3. Push to Ionic Pro and trigger a build

Now sync your updated code to Ionic Pro and start a build:

  • Push your commit to the Ionic Pro remote: git push ionic master (replace master with your target branch if you're using a different one)
  • Log into your Ionic Pro dashboard, select your app, and go to the Build tab
  • Choose the Android platform and start a new build task. The system will use your locked Play Services versions instead of pulling the latest.

Bonus: Avoid manual edits in the future

If you ever remove and re-add the Android platform (ionic cordova platform rm android && ionic cordova platform add android), the project.properties file will reset. To fix this permanently, add the dependency locks directly to your config.xml:

<platform name="android">
    <!-- Add these lines inside the Android platform block -->
    <framework src="com.google.android.gms:play-services-maps:17.0.0" />
    <framework src="com.google.android.gms:play-services-location:17.0.0" />
    <!-- Your existing Android preferences/plugins go here -->
</platform>

This way, every time you add the Android platform, Cordova will automatically inject the correct version numbers into project.properties without you having to edit it manually.

内容的提问来源于stack exchange,提问作者Alex

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:52:49