在将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 maneger中,安装了google play(无法找到任何名为google-play-ads的库)。不过,这个应用程序无法编译。 我该怎么做才能解决这个问题? 提前致谢 亚伊尔
答案 0 :(得分:3)
请按以下方式安装额外的项目: