构build离子应用程序时出错:无法执行aapt(CordovaLib:processDebugResources)

我正在尝试使用Ionic框架来构build混合移动应用程序,但几天以来,我正面临以下问题。

当我想要构build应用程序(实际上是一个空白项目)时,执行CordovaLib:processDebugResources任务时,命令“ ionic cordova build android ”将返回此错误(详细logging如下):

/home/pi/android-sdk/build-tools/23.0.1/aapt: Syntax error: newline unexpected (expecting ")")

我试图重新安装很多次的Android SDK。 我也尝试过不同版本的Android工具/平台(23,26),但它什么也没做。

我没有在网上find任何解决scheme来解决这个问题。 所以,如果有人有一个想法或已经面临这个问题,并解决它,不要犹豫;-)

感谢您的帮助。

  • 构build应用程序时详细logging日志:

     :CordovaLib:generateDebugBuildConfig UP-TO-DATE :CordovaLib:processDebugResources/home/pi/android-sdk/build-tools/23.0.1/aapt: 2: /home/pi/android-sdk/build-tools/23.0.1/aapt: Syntax error: newline unexpected (expecting ")") FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':CordovaLib:processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt * 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: 55.363 secs Error: /home/pi/IonicPJ/platforms/android/gradlew: Command failed with exit code 1 Error output: Picked up _JAVA_OPTIONS: -Xmx256M /home/pi/android-sdk/build-tools/23.0.1/aapt: 2: /home/pi/android-sdk/build-tools/23.0.1/aapt: Syntax error: newline unexpected (expecting ")") FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':CordovaLib:processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt 
  • 您将在下面find有关安装的组件的不同元素。

Ionic 3.8.1 Cordova 7.0.1 Gradle 4.1 JAVA 8

我设置variables$ JAVA_HOME,$ ANDROID_HOME并将$ ANDROID_HOME / tools和$ ANDROID_HOME / platform-tools添加到$ PATHvariables

这是我通过Android SDKManager安装的软件包:

  Installed packages: Path | Version | Description | Location ------- | ------- | ------- | ------- build-tools;23.0.1 | 23.0.1 | Android SDK Build-Tools 23.0.1 | build-tools/23.0.1/ emulator | 26.1.3 | Android Emulator | emulator/ extras;android;m2repository | 47.0.0 | Android Support Repository | extras/android/m2repository/ extras;google;m2repository | 57 | Google Repository | extras/google/m2repository/ patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/ platform-tools | 26.0.0 | Android SDK Platform-Tools | platform-tools/ platforms;android-23 | 3 | Android SDK Platform 23 | platforms/android-23/ platforms;android-25 | 3 | Android SDK Platform 25 | platforms/android-25/ tools | 26.0.2 | Android SDK Tools | tools/ 

当我运行“ 离子cordova平台ls ”时,我有:

Installed platforms: android 6.2.3

所有事情都和Raspbian Jessie一起在树莓上运行:

Linux raspberrypi 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux