Ionic Cordova更新Android版本的问题

时间:2017-11-18 17:56:03

标签: android cordova gradle ionic-framework ionic3

我最近将Ionic CLI升级到v3,并将我的Android Studio更新到新版本。

我有几个现有的Ionic v1项目,即使在更新之后也能正常运行,直到最近。

我的iOS构建正常,但由于某种原因,我的android版本无法正常工作。

错误是错误:产生EACCES

从我读过的有关错误的内容来看,它似乎是一个权限问题,应该通过运行" chmod 777"来解决。在错误中显示的目录上。

我已删除并重新添加了Cordova以及删除并重新添加了Android平台。

但似乎没有任何效果!

以下是带有--verbose标志的android build命令的结果。

我希望有人比我更聪明,可能会看到我失踪的东西。

使用--verbose运行构建的结果:

Mac myprogram$ chmod 755 hooks/after_prepare/*
Mac myprogram$ cordova build android --verbose                           
No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform android
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at /Users/mymac/Documents/Projects/myprogram/platforms/android/res/xml/config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms/android/platform_www] to platforms/android/assets/www
  copy  www/index.html platforms/android/assets/www/index.html (updated file)
Wrote out android application name "myprogram" to /Users/mymac/Documents/Projects/myprogram/platforms/android/res/values/strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (0.0.1): 1
Wrote out Android package name "com.freshconsulting.chainlink.myprogram" to /Users/mymac/Documents/Projects/myprogram/platforms/android/src/com/freshconsulting/chainlink/myprogram/MainActivity.java
Updating icons at platforms/android/res
Updating splash screens at platforms/android/res
This app does not have additional resource files defined
Prepared android project successfully
Executing script found in hooks directory for hook "after_prepare": hooks/after_prepare/010_add_platform_class.js
Running command: /Users/mymac/Documents/Projects/myprogram/hooks/after_prepare/010_add_platform_class.js /Users/mymac/Documents/Projects/myprogram
add to body class: platform-android
Command finished with error code 0: /Users/mymac/Documents/Projects/myprogram/hooks/after_prepare/010_add_platform_class.js /Users/mymac/Documents/Projects/myprogram
Executing script found in plugin cordova-plugin-facebook4 for hook "after_prepare": plugins/cordova-plugin-facebook4/scripts/after_prepare.js
No scripts found for hook "before_compile".
Running command: /usr/libexec/java_home 
Command finished with error code 0: /usr/libexec/java_home 
ANDROID_HOME=/Users/mymac/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
Running command: "/Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/gradle" -p /Users/mymac/Documents/Projects/myprogram/platforms/android wrapper -b /Users/mymac/Documents/Projects/myprogram/platforms/android/wrapper.gradle
Error: spawn EACCES

任何想法都会非常感激!

1 个答案:

答案 0 :(得分:1)

解决问题:

sudo chmod 755 / Applications / Android \ Studio.app/Contents/gradle/gradle-XXX/bin/gradle