Ionic Cordova update issue with Android build [duplicate] - android

This question already has an answer here:
Unable to run cordova run android in IONIC project?
(1 answer)
Closed 5 years ago.
I recently upgraded my Ionic CLI to v3 and updated my Android Studio to the new release as well.
I have a couple existing Ionic v1 projects that were building fine, even after the update, until recently.
My iOS builds fine, but for some reason, my android build is not working.
The error is Error: spawn EACCES
From what I've read about the error, it appears to be a permissions issue that should be resolved by running "chmod 777" on the directory that shows in the error.
I've removed and re-added Cordova as well as removed and re-added the android platform.
But nothing seems to be working!
Below are the results of my android build command with the --verbose flag.
I was hoping someone a lot smarter than me might see something I'm missing.
Results of running build with --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
Any ideas would be GREATLY appreciated!

Resolve problem with:
sudo chmod 755 /Applications/Android\ Studio.app/Contents/gradle/gradle-XXX/bin/gradle

Related

Jenkins cannot create cordova platforms

I have a jenkins job that is supposed to create a cordova app but it's failing some reason that I can't quite identify. The jenkins job simply does this:
cordova platform add android
cordova prepare android
cordova build android --debug --verbose
The first command (cordova platform add android) is resulting in the following error:
ENOENT: no such file or directory, mkdir 'platforms/android/app/src/main'
Error: ENOENT: no such file or directory, mkdir 'platforms/android/app/src/main'
at Object.mkdirSync (fs.js:738:3)
at Object.module.exports.makeDirSync (/Users/me/Documents/Jenkins/sharedspace/apps/my-app/cordova/node_modules/fs-extra/lib/mkdirs/make-dir.js:23:13)
at /Users/me/Documents/Jenkins/sharedspace/apps/my-app/cordova/node_modules/cordova-android/lib/create.js:231:16
+ /Users/me/.nvm/versions/node/v16.13.2/bin/cordova prepare android
(node:23901) ExperimentalWarning: The fs.promises API is experimental
Discovered platform "android". Adding it to the project
EEXIST: file already exists, mkdir '/Users/me/Documents/Jenkins/sharedspace/apps/my-app/cordova/platforms'
+ /Users/me/.nvm/versions/node/v16.13.2/bin/cordova build android --debug --verbose
(node:23902) ExperimentalWarning: The fs.promises API is experimental
No platforms added to this project. Please use `cordova platform add <platform>`.
CordovaError: No platforms added to this project. Please use `cordova platform add <platform>`.
at Object.preProcessOptions (/Users/me/.nvm/versions/node/v16.13.2/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/util.js:275:15)
at /Users/me/.nvm/versions/node/v16.13.2/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/build.js:29:31
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
at startup (internal/bootstrap/node.js:236:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:560:3)
Build step 'Execute shell' marked build as failure
When I look inside the platforms directory on the jenkins box it is empty. It is able to create the platforms folder itself, just nothing else under. It doesn't seem to be a permission issue as far as I can tell. If I ssh into the box as the same user that jenkins in using I can run the cordova commands fine and everything works.
Furthermore, if I add the platform manually by sshing into the box and then let jenkins take over after the android folder already exists, the job works fine. So I guess for some reason it's not able to add the android project.
If it helps, this is what cordova requirements gives:
cordova requirements
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-30,android-29,android-28
Gradle: installed /usr/local/Cellar/gradle/7.3.3/bin/gradle
Okay, I finally figured this SOB out! After taking a few weeks off and coming back to this I noticed that there is a setting in the job config called "Shared Workspace" and I had it set to the value (). I don't know what that means, but it had the effect of putting the code for this project in the
/Users/me/Documents/Jenkins/sharedspace
folder, which apparently was causing problems with cordova. Once I set the Shared Workspace value to NONE, it moved the project to the
/Users/trident/Documents/Jenkins/workspace/my-app
folder which is more what I would expect. After that, lo and behold, everything works.

on a fresh install of PhoneGap, "phonegap run android" results in "Error: Cannot read property 'length' of undefined"

The objective:
My goal at this point is to simply create a new phonegap app based on their hello-world template, and test it in an Android emulator on my Windows PC. I've run into a number of snags along the way, most of which I've been able to resolve, until now. I'm a relative newcomer to node.js, and this is the first time I've ever tried using phonegap; I'm trying to use this template as a way to get started.
There seem to be two similar issues on this site, but I wasn't able to extract a working solution from either:
Cordova Android build error "Cannot read property 'length' of undefined"
https://pt.stackoverflow.com/questions/219442/cordova-build-android-error-cannot-read-property-length-of-undefined
First I'll explain exactly what I'm typing and what response I'm getting. Then I'll provide more details about my environment, and the steps I've taken to get this far.
The command:
$ phonegap run android
The response:
[phonegap] executing 'cordova run android ' ...
ANDROID_HOME=c:\android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
Error: Cannot read property 'length' of undefined
There's not even any indication of where this error happened, which makes it especially difficult to track down in a library full of code I've never seen before.
The sample app:
I haven't even done any coding at this point. The app I'm trying to run was generated using this command:
phonegap create pgHello --id "com.pghello.app" --name "pgHello" --template hello-world
My environment:
Windows 7 Professional x64 SP1
Java SDK 8u131 (I had to install this because 7u79 was too old.) I also had to manually configure the JAVA_HOME and ANDROID_HOME environment variables.
npm 5.2.0:
$ npm version
{ npm: '5.2.0',
ares: '1.10.1-DEV',
cldr: '30.0.3',
http_parser: '2.7.0',
icu: '58.2',
modules: '51',
node: '7.9.0',
openssl: '1.0.2k',
tz: '2016j',
unicode: '9.0',
uv: '1.11.0',
v8: '5.5.372.43',
zlib: '1.2.11' }
phonegap 6.5.2 (installed via npm)
cordova 6.5.0 (part of phonegap)
cordova android platform 6.2.2 (updated via phonegap because the older version was having fits over a missing gradle; with this, the gradle problem went away. That solution was found here: Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK - Android)
Android Studio 2.3.3 (here's a link to my Android SDK tools screen capture)
UPDATE:
This time I executed the same command with the --verbose flag:
No scripts found for hook "before_run".
No scripts found for hook "before_prepare".
Checking config.xml for saved platforms 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 C:\nodejs\apps\pgHello\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
Wrote out android application name "pgHello" to C:\nodejs\apps\pgHello\platforms\android\res\values\strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.0): 10000
Wrote out Android package name "com.pghello.app" to C:\nodejs\apps\pgHello\platforms\android\src\com\pghello\app\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
No scripts found for hook "after_prepare".
Checking config.xml for saved plugins that haven't been added to the project
ANDROID_HOME=c:\android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
Error: TypeError: Cannot read property 'length' of undefined
at Object.module.exports.check_gradle (C:\nodejs\apps\pgHello\platforms\android\cordova\lib\check_reqs.js:143:19)
at GradleBuilder.prepEnv (C:\nodejs\apps\pgHello\platforms\android\cordova\lib\builders\GradleBuilder.js:176:23)
at Api.module.exports.run (C:\nodejs\apps\pgHello\platforms\android\cordova\lib\build.js:152:20)
at C:\nodejs\apps\pgHello\platforms\android\cordova\Api.js:348:43
at _fulfilled (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:624:44
at runSingle (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (C:\nodejs\apps\pgHello\platforms\android\cordova\node_modules\q\q.js:125:13)
Is this a bug in gradle?
UPDATE 2:
Since PhoneGap essentially is Cordova, I decided to nix the phonegap package and install cordova instead. The results, perhaps unsurprisingly, are very similar.
$ npm uninstall -g phonegap
removed 873 packages in 87.918s
$ npm install -g cordova
npm WARN deprecated node-uuid#1.4.8: Use uuid module instead
C:\Users\bbale\AppData\Roaming\npm\cordova -> C:\Users\bbale\AppData\Roaming\npm\node_modules\cordova\bin\cordova
+ cordova#7.0.1
added 602 packages in 107.461s
$ cordova create pushTest com.copperfielld.kostizi.pushtest pushTest
Creating a new cordova project.
$ cd pushtest
$ cordova platform add android#6.2.3
Using cordova-fetch for cordova-android#6.2.3
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.copperfielld.kostizi.pushtest
Name: pushTest
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with cordova-android#6.2.3
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
Adding cordova-plugin-whitelist to package.json
Saved plugin info for "cordova-plugin-whitelist" to config.xml
--save flag or autosave detected
Saving android#~6.2.3 into config.xml file ...
$ cordova run android
ANDROID_HOME=c:\android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
Error: Cannot read property 'length' of undefined
$ cordova run android --verbose
No scripts found for hook "before_run".
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 C:\nodejs\apps\pushTest\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
Wrote out android application name "pushTest" to C:\nodejs\apps\pushTest\platforms\android\res\values\strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.0): 10000
Wrote out Android package name "com.copperfielld.kostizi.pushtest" to C:\nodejs\apps\pushTest\platforms\android\src\com\copperfielld\kostizi\pushtest\MainActivity.java
This app does not have launcher icons defined
This app does not have splash screens defined
This app does not have additional resource files defined
Prepared android project successfully
No scripts found for hook "after_prepare".
ANDROID_HOME=c:\android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
Error: Cannot read property 'length' of undefined
To answer my own question from earlier: no, this doesn't appear to be a bug in gradle. It seems to be a bug in the cordova android platform where it checks to see if gradle is installed--so gradle hasn't even been invoked yet.
I suspect this because versions of the cordova android platform prior to 6.2.2 will throw "Error: Error" instead of "Error: Cannot read property 'length' of undefined".
Can anyone verify that this is the case?
UPDATE 3:
Trying a new command here:
$ cordova requirements
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-26,android-25,android-24,Google Inc.:Google APIs:24,android-23,android-22,android-21
Gradle: not installed
Cannot read property 'length' of undefined
Error: Some of requirements check failed
It says Gradle is not installed, but I can verify that it is:
$ gradle -v
------------------------------------------------------------
Gradle 4.0.1
------------------------------------------------------------
Build time: 2017-07-07 14:02:41 UTC
Revision: 38e5dc0f772daecca1d2681885d3d85414eb6826
Groovy: 2.4.11
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_131 (Oracle Corporation 25.131-b11)
OS: Windows 7 6.1 amd64
I've also tried setting GRADLE_HOME and GRADLE_PATH environment variables, to no avail.
It turns out the solution to this problem was this:
uninstall Android Studio
delete any folders from Program Files with names similar to "Android Studio"
reinstall Android Studio
The cause of the problem is that the build script was looking for an apparently hard-coded path, "C:\Program Files\Android\Android Studio\gradle", to find out what versions of gradle were installed.
But I had recently upgraded to a new version of Android Studio on my machine, and the installer put the new version in a different folder: "C:\Program Files\Android\Android Studio1" instead of "C:\Program Files\Android\Android Studio".
I could have copied the gradle folder from the "Android Studio1" folder to the "Android Studio" folder. That would have been a workable quick fix, but I would have lost the ability to take advantage of automatic updates for gradle in Android Studio. The "uninstall/delete/install" method is much more reliable.
This is the ticket I submitted to Apache's Cordova project:
https://issues.apache.org/jira/browse/CB-13104
Nikita Matrosov provided the key piece of information I needed to solve this problem.
I had this error in ionic and solved it by setting gradle path in windows 7
GRADLE_HOME=C:\Users\myUser\.gradle\wrapper\dists\gradle-5.4.1-all\xyz..lablabla\gradle-5.4.1
path= %GRADLE_HOME%\bin;%path%
and then open new console and check if it's work by this command
gradle -v
close your console or your id like vscode and then run
phonegap run android
or
ionic cordova run android

Cordova Android build error "Cannot read property 'length' of undefined"

I have an older cordova project that I am updating. As a part of this process, I removed the android platform and readded it.
Now when I try to build the project I get the following error:
C:\App>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 C:\App\platforms\android\res\xml\config.xml
Merging project's config.xml into platform-specific android config.xml
Found "merges/android" folder. Copying its contents into the android project.
Merging and updating files from [www, platforms\android\platform_www, merges\android] to platforms\android\assets\www
Wrote out android application name "App" to C:\App\platforms\android\res\values\strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.20): 10020
Wrote out Android package name "com.nge.app" to C:\App\platforms\android\src\com\nge\bca\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
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
ANDROID_HOME=C:\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_40
Error: Cannot read property 'length' of undefined
This did work before I removed the platform so I am guessing it is a bug or a config file that changed.
There is a similar issue here: https://pt.stackoverflow.com/questions/219442/cordova-build-android-error-cannot-read-property-length-of-undefined
I found another solution by downgrading Android to version 6.1.2, since the suggestions here (and many other suggestions on various forums, like reinstalling plugins, etc.) didn't work for me:
cordova platform update android#6.1.2 --save
If that doesn't work at first hand, try the following:
First remove android platform:
cordova platform remove android
Add Android version 6.1.2:
cordova platform add android#6.1.2
Build Android:
cordova build android
Here are some additional steps I took prior to above (on Mac), just to make sure:
Download the latest JDK and install.
Add JAVA_HOME this way:
echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.bash_profile
Restart shell (CMD+Q and open again)
Make sure echo $JAVA_HOME equals to Android Studio -> File -> Project Structure -> JDK Location
For me, this is the following path and version:
/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
Update Android Studio and all of the SDK packages
Update npm
npm update -g
Note: On OS X 10.11 El Capitan or greater, run:
sudo npm update -g --unsafe-perm=true
Update Cordova
npm update -g cordova
If all of this didn't work for you and you are left with no other choice, I suggest you try downgrading Cordova to version 6.4.0:
npm update -g cordova#6.4.0
You can downgrade cordova cli using
npm install -g cordova#6.4.0
and build the project with give command
ionic cordova build android
no need to add platform, it'll automatically add.
If it ask to update cordova cli, then choose no
Resolved an error by following:
Hi all,
Resolved problem to run cordova run android via command prompt for cordova project attached problem screenshot.
To resolve this problem removed all environment variables under Advanced System settings.
Uninstalled java and installed again, downloaded old sdk tools to avoid prompt for eclipse now.
Under user variable added
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_131
Under System variable
ANDROD_HOME = C:\cordova\android-sdk
Path = C:\Program Files\Android\Android Studio2\gradle\gradle-3.2\bin\;%JAVA_HOME%\bin to avoid error:
No installed build tools found. Install the Android build tools version 19.1.0 or higher.
Problem resolved now 😊
The problem was that my gradle version was 2.1 where Cordova wanted 3.2. Updating Android Studio (It was at 2.1) and making sure the environment variables are upto date was the main trick to get it to work again.

spawn EACCESS Error while running / building Android Platform on Ionic 3

As many users, i had this error when doing
ionic cordova run android -android
or
cordova build android --verbose
the output :
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/davidanquetin/GIT/MEDIATOOLS/DOMME/domme-app/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
Wrote out android application name "Domme" to /Users/davidanquetin/GIT/MEDIATOOLS/DOMME/domme-app/platforms/android/res/values/strings.xml
Wrote out Android package name "com.pasquet.domme.all" to /Users/davidanquetin/GIT/MEDIATOOLS/DOMME/domme-app/platforms/android/src/com/pasquet/domme/all/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
No scripts found for hook "after_prepare".
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/davidanquetin/Documents/_UTILITAIRES/TECHNIQUE/android-sdk-macosx/
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home
Running command: "/Applications/Android Studio 3.0 Preview.app/Contents/gradle/gradle-4.0-milestone-1/bin/gradle" -p /Users/davidanquetin/GIT/MEDIATOOLS/DOMME/domme-app/platforms/android wrapper -b /Users/davidanquetin/GIT/MEDIATOOLS/DOMME/domme-app/platforms/android/wrapper.gradle
Error: spawn EACCES
i tried many manipulations founded on the web (chmod etc...) but nothing is working..
when i try
chmod +x /Applications/Android Studio 3.0 Preview.app/Contents/gradle/gradle-4.0-milestone-1/bin/gradle
i have :
chmod + /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/gradle/gradle-4.0-milestone-1/bin/gradle
and always the same error after building...
thanks for ideas !
UPDATE / RESOLVED
The way i resolved the problem :
delete Android Studio app
redownload and reinstall it
update java
creating a new ionic project, then update it with my previous assets / code files.
reinstall platforms with a clean installation
and...it works !
I think it is manly Android Studio removing and reinstallation which resolves the problem.
If it could help !
UPDATE / RESOLVED
The way i resolved the problem :
delete Android Studio app
redownload and reinstall it
update java
creating a new ionic project, then update it with my previous assets
/ code files.
reinstall platforms with a clean installation
and...it works ! I think it is manly Android Studio removing and reinstallation which resolves the problem.
If it could help !

Error : Unable to prepare project

While trying to do a release using the following command:
code-push release-cordova myApp android
I'm getting the following error in the terminal:
Running "cordova prepare" command:
[Error] Unable to prepare project. Please ensure that this is a Cordova project and that platform "android" was added with "cordova platform add android"
Any one knows what might be wrong? The project is a cordova project created using the command:
cordova create myApp
And also has android platform added.
UPDATE :
Running cordova prepare android --verbose returns the following output :
Executing "before_prepare" hook for all plugins.
Searching PlatformJson files for differences between project vs. platform installed plugins
No differences found between project and android platform. Continuing...
Generating config.xml from defaults for platform "android"
Wrote out Android application name to "HelloCordova"
Wrote out Android package name to "io.cordova.hellocordova"
This app does not have launcher icons defined
updated project successfully
Executing "after_prepare" hook for all plugins.
Make sure your Nodejs is the last version.
code-push-cli required "child_process"
That error indicates that the current working directory didn't represent the root of a Cordova project at the time that you ran the release-cordova command. Can you make sure that you CD into the directory that contains the www, platforms, plugins, etc. directories, and then run the release-cordova command? That should do the trick for you

Categories

Resources