2016-08-01 60 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版本的问题。这不是我的问题。此外,我试图降级节点,仍然无法建立我的应用程序。 –