我很熟悉Phonegap和cordova。我有一个任务来建立一个现有的项目。所以我在项目root derictory中解雇了以下命令:
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位机器上构建。 任何人都可以帮我解决我的问题。
答案 0 :(得分:0)
我找到了我的解决方案,我刚安装了我的android sdk中缺少的Google Repository
和Android support Repository
,这对我有用。