【问题标题】:Cordova compiling fails with admob - missing com.google.android.gms:play-services-ads:+Cordova 编译失败并出现 admob - 缺少 com.google.android.gms:play-services-ads:+
【发布时间】:2015-06-17 20:39:19
【问题描述】:

在将 admob 集成到我的 cordova 应用程序中出现问题后,我决定按照此处列出的示例进行操作: https://github.com/floatinghotpot/cordova-admob-pro

当我使用 Windows 7 时,我已经进行了必要的更改,但它看起来像这样:

C:\> cordova create test1 com.rjfun.test1 Test1
Creating a new cordova project.

C:\>cd test1

C:\test1>cordova platform add android
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: com.rjfun.test1
        Name: Test1
        Activity: MainActivity
        Android target: android-22
Copying template files...
Android project created with cordova-android@4.0.0
Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project
Fetching plugin "cordova-plugin-whitelist@1" via npm
npm http GET https://registry.npmjs.org/cordova-plugin-whitelist
npm http 304 https://registry.npmjs.org/cordova-plugin-whitelist
Installing "cordova-plugin-whitelist" for android

C:\test1>cordova plugin add cordova-plugin-admobpro
Fetching plugin "cordova-plugin-admobpro" via npm
npm http GET https://registry.npmjs.org/cordova-plugin-admobpro
npm http 200 https://registry.npmjs.org/cordova-plugin-admobpro
npm http GET https://registry.npmjs.org/cordova-plugin-admobpro/-/cordova-plugin-admobpro-2.8.3.tgz
npm http 200 https://registry.npmjs.org/cordova-plugin-admobpro/-/cordova-plugin-admobpro-2.8.3.tgz
Installing "cordova-plugin-admobpro" for android
Fetching plugin "cordova-plugin-extension" via npm
npm http GET https://registry.npmjs.org/cordova-plugin-extension
npm http 304 https://registry.npmjs.org/cordova-plugin-extension
Installing "cordova-plugin-extension" for android

C:\test1>rmdir /S www
www, Are you sure (Y/N)? y

C:\test1>copy plugins\cordova-plugin-admobpro\test\* www\
plugins\cordova-plugin-admobpro\test\admob_simple.js
plugins\cordova-plugin-admobpro\test\index.html
        2 file(s) copied.


C:\test1> cordova run android
Running command: C:\test1\platforms\android\cordova\run.bat
ANDROID_HOME=C:\Users\dell\AppData\Local\Android\android-studio\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_20
WARNING : No target specified, deploying to device '192.168.221.101:5555'.
Running: C:\test1\platforms\android\gradlew cdvBuildDebug -b C:\test1\platforms\android\build.gradle -PcdvBuildArch=x86 -Dorg.gradle.daemon=true

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.google.android.gms:play-service
s-ads:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-ads/maven-metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-ads/
         file:/C:/Users/dell/AppData/Local/Android/android-studio/sdk/extras/android/m2repository/com/google/android/gms/play-services-ads/maven-metadata.xml
         file:/C:/Users/dell/AppData/Local/Android/android-studio/sdk/extras/android/m2repository/com/google/android/gms/play-services-ads/
     Required by:
         :android:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.

BUILD FAILED

Total time: 1 mins 38.526 secs

C:\test1\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s /c "C:\test1\platforms\android\gradlew cdvBuildDebug -b C:\test1\platforms\android\build.gradle -PcdvBuildArch=x86 -Dorg.gradle.daemon=true"
ERROR running one or more of the platforms: Error: C:\test1\platforms\android\cordova\run.bat: Command failed with exit code 8
You may not have the required environment or OS to run this project

我已确保在我的 SDK 管理器中安装了 google play(找不到任何名为 google-play-ads 的库)。尽管如此,这个应用程序还是无法编译。 我能做些什么来解决这个问题? 提前致谢 亚尔

【问题讨论】:

    标签: android cordova admob


    【解决方案1】:

    请按以下方式安装额外的项目:

    【讨论】:

    • 不是。我已经在我的计算机上安装了您在此处标记的所有内容。为了安全起见,我把所有东西都安装在了额外的安装下。没有帮助。
    • 我发现这个错误毕竟与谷歌回购有关。安装包含错误。我卸载并重新安装了它。成功了
    猜你喜欢
    • 2019-11-28
    • 1970-01-01
    • 2019-04-17
    • 1970-01-01
    • 2010-11-11
    • 2020-01-19
    • 1970-01-01
    • 1970-01-01
    • 2017-10-01
    相关资源
    最近更新 更多