Android AdMob 和 Maven

Android AdMob and Maven(Android AdMob 和 Maven)
本文介绍了Android AdMob 和 Maven的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Android 项目,我需要从相同的来源构建同一应用程序的多个版本.

I have an Android Project where I need to build multiple versions of the same application from the same sources.

为此,我使用 适用于 Maven 的 Android 插件

每个版本都必须能够包含来自 admob 的广告.所以在我的 POM 中我添加了这个依赖

Each version must be able to include ads from admob. So in my POM I added this dependancy

<dependency>
   <groupId>com.admob.android</groupId>
   <artifactId>ads</artifactId>
   <version>20101109-ANDROID-3312276cc1406347</version>
   <scope>system</scope>
   <systemPath>THE_PATHlibsadmob-sdk-android.jar</systemPath>
 </dependency>

我在构建时没有收到任何错误,但是当我执行应用程序时出现此异常

I don't get any errors at build time but, when I execute the application I get this exception

java.lang.ClassNotFoundException: com.admob.android.ads.AdView

所以显然这个包没有正确包含?

So apparently the package is not properly included ?

推荐答案

您不能将系统范围用于运行时所需的库.将 jar 部署到本地存储库或存储库服务器(使用例如 mvn install:installFile ..) 并从依赖声明中删除范围和 systemPath.

You can NOT use system scope for runtime required libraries. Deploy the jar into your local repository or your repository server (using e.g. mvn install:installFile ..) and remove scope and systemPath from the dependency declaration.

更新:截至最新版本,我的 Maven Android SDKDeployer 可以为您将 SDK 中的 AdMob jar 安装到您的本地 Maven 存储库或存储库服务器中.

Update: As of the latest releases my Maven Android SDK Deployer can do the install of the AdMob jar from the SDK into your local Maven repository or repository server for you.

这篇关于Android AdMob 和 Maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Publish an Android library to Maven with AAR and sources JAR(使用AAR和源代码JAR将Android库发布到Maven)
Gradle 7 and jitpack.io runs into error during publish(Gradle 7和jitpack.io在发布期间出错)
android gradle plugin - offline installation(Android Gradle插件-脱机安装)
Build was configured to prefer settings repositories over project repositories but repository #39;maven#39; was added by build file #39;build.gradle#39;(Build被配置为首选设置存储库而不是项目存储库,但存储库是通过生成文件build.gradle添加的)
Cant find maven dependency for Google APIs to use maps(找不到 Google API 使用地图的 Maven 依赖项)
You uploaded an APK that was signed in debug mode. You need to sign your APK in release mode error(您上传了一个在调试模式下签名的 APK.You need to sign your APK in release mode error)