2016-08-01 93 views
0

我開始了一個帶有Android平臺標籤的新離子項目,在那裏我可以正常構建/運行它。但是在修改項目中的一些代碼(只是.html和.js文件)後,我總是收到構建錯誤。這裏是消息:離子構建失敗 - 找到發生錯誤的行

$ ionic build android 
✗ (node:16936) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version. 

You have been opted out of telemetry. To change this, run: cordova telemetry on. 
Running command: "C:\Program Files\nodejs\node.exe" "D:\Ionic Projects\Ofertas\hooks\after_prepare\010_add_platform_class.js" "D:/Ionic Projects/Ofertas" 
add to body class: platform-android 
ANDROID_HOME=C:\android-sdk_r24.4.1-windows 
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_45 
Incremental java compilation is an incubating feature. 
: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:mergeDebugShaders UP-TO-DATE 
:CordovaLib:compileDebugShaders 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:incrementalDebugJavaCompilationSafeguard 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 
:mergeDebugShaders UP-TO-DATE 
:compileDebugShaders 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 FAILED 


BUILD FAILED 

Total time: 1.105 secs 
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 'C:\android-sdk_r24.4.1-windows\build-tools\24.0.1\aapt.exe'' 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. 
Error: cmd: Command failed with exit code 1 Error output: 
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 'C:\android-sdk_r24.4.1-windows\build-tools\24.0.1\aapt.exe'' 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. 

可能是我的代碼有錯誤。那麼,有沒有辦法找到有錯誤的行?不知道如何使用--info或--debug標誌。

回答

0

經過一週的試圖解決這個問題,找到一個解決方案。該錯誤是由以非ascii字符命名的圖像(位於www/img /)引起的。所以我只是重命名文件,一切正常!

0

當我將node.js更新到版本6+時,我收到了同樣的錯誤。鏈接中還記錄了此問題:https://github.com/driftyco/ionic-cli/issues/960

使用nvm將節點降級爲長期支持(LTS)版本(當前爲v4.4.7)以解決此問題。

+0

github中報告的問題與我公開的不同。用戶提到了有關已棄用的graceful-fs版本的問題。這不是我的問題。此外,我試圖降級節點,仍然無法建立我的應用程序。 –