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

Qt5/Android集成AdMob缺失libproject目录的技术求助

Fixing Missing google-play-services_lib for Qt5/Android AdMob Integration

Hey there, I’ve run into this exact issue before—Google phased out the old libproject structure for Google Play Services a while back, moving everything to the Maven repository (m2repository) instead. Let’s walk through how to extract the necessary library files correctly:

Step 1: Locate the right AAR file in m2repository

Navigate to this path in your Android SDK:

android-sdk/extras/google/m2repository/com/google/android/gms/play-services-ads/

Pick a stable version (match it to the AdMob requirements of your open-source library—stick to recent but non-beta releases for reliability). Inside the version folder, you’ll find a file named play-services-ads-[your-version].aar.

Step 2: Extract the AAR content

  • Rename the .aar file to .zip (AAR files are just zip archives under the hood).
  • Unzip it into a folder named google-play-services_lib (this is the name your open-source library expects).

Step 3: Organize the extracted files

The unzipped folder will have several files/folders. Here’s what you need to keep and structure:

  • Create a libs subfolder inside google-play-services_lib, then move the classes.jar file into it.
  • Keep the res folder (contains AdMob’s required resources like strings and drawables) and AndroidManifest.xml (if present) in the root of google-play-services_lib.
  • Move the fully organized google-play-services_lib folder to the same directory as your project’s AndroidManifest.xml (usually the android subfolder of your Qt project).
  • Open Qt Creator, go to your project’s Android settings, and make sure the library is added as a dependency. If Qt doesn’t auto-detect it, you can manually add a reference in your project’s build.gradle file under the dependencies block:
    compile project(':google-play-services_lib')
    
  • Trigger a Gradle sync (Qt Creator usually prompts this automatically when changes are made) to ensure everything is hooked up correctly.

Quick Notes

  • Double-check that you have the Google Repository installed via the Android SDK Manager—this is what populates the m2repository folder with these libraries.
  • Always match the play-services-ads version to the requirements of your AdMob integration library to avoid compatibility crashes.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 11:18:11