0

我是Phonegap和cordova的初学者。我的任务是构建一个现有项目。所以我在项目根目录中触发了以下命令:

cordova build android

但它没有成功构建,并显示以下错误日志:

D:\Git\xyz\myCart>cordova platforms
Installed platforms: android 4.0.0, ios 3.8.0
Available platforms: amazon-fireos, blackberry10, browser, firefoxos, webos, win
dows, windows8, wp8

D:\Git\xyz\myCart>cordova build android
Running command: "C:\Program Files\nodejs\node.exe" D:\Git\xyz\myCart\
hooks\before_prepare\add_plugins.js D:\Git\xyz\myCart
(node) sys is deprecated. Use util instead.
(node) util.puts is deprecated. Use console.log instead.




Running command: "C:\Program Files\nodejs\node.exe" D:\Git\xyz\myCart\
hooks\before_prepare\text_replace.js D:\Git\xyz\myCart
Running command: "C:\Program Files\nodejs\node.exe" D:\Git\xyz\myCart\
hooks\after_prepare\text_replace.js D:\Git\xyz\myCart
Running command: cmd "/s /c "D:\Git\xyz\myCart\platforms\android\cordo
va\build.bat""
ANDROID_HOME=D:\2015\tools\adt-bundle-windows-x86_64-20140702\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_60
Running: D:\Git\xyz\myCart\platforms\android\gradlew cdvBuildDebug -b
D:\Git\xyz\myCart\platforms\android\build.gradle -Dorg.gradle.daemon=t
rue
embedded
WARNING [Project: :] Current NDK support is deprecated.  Alternative will be pro
vided in the future.
WARNING [Project: :] Current NDK support is deprecated.  Alternative will be pro
vided in the future.
WARNING [Project: :] Current NDK support is deprecated.  Alternative will be pro
vided in the future.
WARNING [Project: :] Current NDK support is deprecated.  Alternative will be pro
vided in the future.
org.xwalk:xwalk_core_library:14+

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugCompile'.
   > Could not find any version that matches com.google.android.gms:play-service
s-analytics:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-ana
lytics/maven-metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-ana
lytics/
         https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com
/google/android/gms/play-services-analytics/maven-metadata.xml
         https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com
/google/android/gms/play-services-analytics/
     Required by:
         :android:unspecified
   > Could not find any version that matches com.google.android.gms:play-service
s-gcm:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm
/maven-metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm
/
         https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com
/google/android/gms/play-services-gcm/maven-metadata.xml
         https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com
/google/android/gms/play-services-gcm/
     Required by:
         :android:unspecified
   > Could not find any version that matches com.android.support:support-v4:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/android/support/support-v4/maven-met
adata.xml
         https://repo1.maven.org/maven2/com/android/support/support-v4/
         https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com
/android/support/support-v4/maven-metadata.xml
         https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com
/android/support/support-v4/
     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: 10.089 secs

D:\Git\xyz\myCart\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                    ^
 Error code 1 for command: cmd with args: /s /c "D:\Git\xyz\myCart\pla
tforms\android\gradlew cdvBuildDebug -b D:\Git\xyz\myCart\platforms\an
droid\build.gradle -Dorg.gradle.daemon=true"
 ERROR building one of the platforms: Error: cmd: Command failed with exit code
1
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1

D:\Git\xyz\myCart>

当我在 Mac 上构建相同的项目时,它会成功构建,但不是在我的 windows-7 64 位机器上。谁能帮我解决我的问题。

4

1 回答 1

0

我找到了我的解决方案,我刚刚安装Google Repository并且Android support Repository在我的 android sdk 中缺少它,它对我有用。

于 2016-05-05T13:34:27.523 回答