Phonegap没有建立到Android

时间:2016-07-30 11:40:05

标签: android cordova

我正在使用Ubuntu 16.04 x64来构建我的Phonegap项目,我已经安装了Android StudioSDK,并在SDK Manager中全部更新。

但是当我尝试使用命令phonegap build android进行构建时,返回以下错误:

BUILD FAILED

Total time: 2.069 secs

phonegap build android --debug
[phonegap] executing 'cordova build android --debug ' ...
cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/icon/android/drawable-ldpi-icon.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/icon/android/drawable-mdpi-icon.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/icon/android/drawable-hdpi-icon.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/icon/android/drawable-xhdpi-icon.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/icon/android/drawable-xxhdpi-icon.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/icon/android/drawable-xxxhdpi-icon.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-land-ldpi-screen.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-land-mdpi-screen.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-land-hdpi-screen.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-land-xhdpi-screen.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-land-xxhdpi-screen.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-land-xxxhdpi-screen.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-port-ldpi-screen.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-port-mdpi-screen.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-port-hdpi-screen.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-port-xhdpi-screen.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-port-xxhdpi-screen.png


cp: no such file or directory: /home/lxuancheng/Documents/Projects/dont-press/www/res/screen/android/drawable-port-xxxhdpi-screen.png


ANDROID_HOME=/opt/android-sdk-linux

JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

:preBuild UP-TO-DATE

:preDebugBuild

UP-TO-DATE


:checkDebugManifest


:CordovaLib:preBuild UP-TO-DATE

:CordovaLib:preDebugBuild
 UP-TO-DATE

:CordovaLib:compileDebugNdk
 UP-TO-DATE

:CordovaLib:compileLint


:CordovaLib:copyDebugLint
 UP-TO-DATE

:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest

:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript

UP-TO-DATE


:CordovaLib:generateDebugResValues

UP-TO-DATE


:CordovaLib:generateDebugResources

UP-TO-DATE


:CordovaLib:packageDebugResources
 UP-TO-DATE

:CordovaLib:compileDebugAidl

UP-TO-DATE


:CordovaLib:generateDebugBuildConfig
 UP-TO-DATE

:CordovaLib:generateDebugAssets
 UP-TO-DATE
:CordovaLib:mergeDebugAssets

UP-TO-DATE


:CordovaLib:processDebugManifest

UP-TO-DATE


:CordovaLib:processDebugResources

UP-TO-DATE


:CordovaLib:generateDebugSources

UP-TO-DATE


:CordovaLib:compileDebugJavaWithJavac
 UP-TO-DATE

:CordovaLib:processDebugJavaRes
 UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug

UP-TO-DATE


:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug

UP-TO-DATE


:CordovaLib:mergeDebugJniLibFolders

UP-TO-DATE


:CordovaLib:transformNative_libsWithMergeJniLibsForDebug

UP-TO-DATE


:CordovaLib:transformNative_libsWithSyncJniLibsForDebug

UP-TO-DATE

:CordovaLib:bundleDebug

UP-TO-DATE

:prepareAndroidCordovaLibUnspecifiedDebugLibrary

UP-TO-DATE

:prepareDebugDependencies


:compileDebugAidl
 UP-TO-DATE

:compileDebugRenderscript
 UP-TO-DATE
:generateDebugBuildConfig
 UP-TO-DATE

:generateDebugAssets
 UP-TO-DATE
:mergeDebugAssets

UP-TO-DATE
:generateDebugResValues

UP-TO-DATE

:generateDebugResources
 UP-TO-DATE

:mergeDebugResources

UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources
/home/lxuancheng/Documents/Projects/dont-press/platforms/android/build/intermediates/res/merged/debug/values/values.xml:4 : AAPT: Apostrophe not preceded by \ (in Don't Press!)


 FAILED



FAILURE: 
Build failed with an exception.




* What went wrong:

Execution failed for task ':processDebugResources'.

> 
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/opt/android-sdk-linux/build-tools/24.0.1/aapt'' finished with non-zero exit value 1



* 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: 2.408 secs

Error: Error code 1 for command: /home/lxuancheng/Documents/Projects/dont-press/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/lxuancheng/Documents/Projects/dont-press/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

3 个答案:

答案 0 :(得分:1)

values.xml第4行:

AAPT: Apostrophe not preceded by \ (in Don't Press!)

请将您的字符串更新为Don\'t Press!以逃避撇号。

答案 1 :(得分:0)

当您在Android Studio中打开项目时,它使用自己的gradle版本,此版本与phonegap构建在大多数时间使用的版本不同。

试试这个,它应该有效:

  1. 删除android构建文件:phonegap clean
  2. 然后:phonegap build android

答案 2 :(得分:0)

我在另一台计算机上创建了Phonegap项目。

我解决了这个问题,在我的实际电脑中重新创建了Phonegap项目,并合并了www文件夹。

我的项目已更新www文件夹,因此它没有www/res文件夹,这可能会使我的项目无法构建。