I am just getting started with with Cordova ( PhoneGap ) and trying to build my first project with it, however I am running into a problem with my compilation step- when I try to build ( in tracking down the problem I broke down the build step into prepare and compile and the former works fine as far as I know ) I see this:
~/Projects/MyProject$ cordova compile android
Compiling app on platform "android" via command "/media/glenatron/local disk/Projects/Cordova/MyProject/platforms/android/cordova/build"
{ [Error: spawn EACCES] code: 'EACCES', errno: 'EACCES', syscall: 'spawn' }
Now from what I can tell this is a permissions problem, but having no Node or Cordova experience yet I am at a loss as to how to troubleshoot it. It looks as though it is trying to spawn another process - maybe the Android SDK? - and it is failing.
Is there a way I can ask Node or Cordova to give me more information on what is going on or is there a log file somewhere that will help me to track down what the problem is?
Edit: I realised cordova has a --verbose switch and when I activated it I get the above output with an additional couple of lines...
Error: spawn EACCES
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
Unfortunately, they don't seem to actually give much more information, like which process it can't start.
For me, this has fixed it:
chmod 777 /Applications/Android\ Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle
It's a permission issue, just execute:
chmod 777 "/media/glenatron/localdisk/Projects/Cordova/MyProject/platforms/android/cordova/build"
That should fix the problem.
Using verbose like Solidak suggested works.
cordova build --release --verbose android
The last command was to access /platforms/android/gradlew so i chmod +x that file and it worked.
Its different for every one, I guess. Running --verbose would give you the file that Cordova needs access to. From there you can chmod 777 <file>. The command you should run to figure out the inaccessible file looks like this: cordova build --release --verbose android
I was facing the same issue. In my case, I had put the sample cordova project on a different ext3 partition than home folder. Since the partition was not NTFS, permissions shouldn't have been a problem. But when I tried all suggested methods (changing permissions, making everything executable), none of them worked. This problem went away as soon as I created the sample cordova folder in my home partition.
For MAC users change the name from "Android Studio" to AndroidStudio. My cordova build was taking back slash() in name of android studio so i changed the name of app.
It is working for me.
Related
Launching lib/main.dart on Android SDK built for x86 in debug mode...
[!] Gradle does not have execution permission.
You should change the ownership of the project directory to your user, or move the project to a directory with execute permissions.
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I got the same error trying to execute flutter run on a mac. Apparently, in your flutter project, there is a file android/gradlew that is expected to be executable (and it wasn't). So in my case, I ran...
chmod a+rx android/gradlew
...afterwards the flutter command worked.
FOR FLUTTER
I have tried mostly everything mentioned here and on my own. The solution, actually, it is a series of solutions and worked for me, I am mentioning them try as you wish.
Make sure no antivirus *firewall is blocking,
gradle.bat, gradlew.bat,
git,
flutter,
android studio
Get the latest Gradle and install it to lower privilege directory, not in Program Files or Program Files (X86); I did it in D drive.
Don't forget to update the path in Environment Variables.
I also installed JAVA Runtime (JRE).
Install git as it is necessary for flutter.
You can Check-in windows command line after installing each (Git, Gradle and flutter doctor). if nothing seems to work Restart the pc after each.
You might try it first, Disable the Gradle plugin and re-enable and restart android studio.
After this when you will compile /run the app it will take a long time please bear with that(at least 15 min just to be sure).
I had the app directory with Read, Write & Modifying permissions still, it was giving that error-
Error code 1 "gradle does not have execution permission. you should change the ownership of the project directory to your user, or move the project to a directory with execute permissions."
so I think it is related to the connection with the plugin.
Hope it helped :-)
Try to set the execution flag on your gradlew file:
chmod +x gradlew
chmod a+rx android/gradlew
This works but for windows you need to install "Git for Windows"
I keep getting this error when running the app on mobile android device, can anyone help.
The actual error:
Error: Requiring unknown module "react". If you are sure the module is there, try restarting the package or running "npm install". (index.android.bundle:93)
This is a pretty common error when developing React Native apps
Standing in the project root fgrep -rlo "React" . | grep -v "node_modules" will give you all places where "React" is being called
If this doesn't help you find your issue, there are lots of things you can try but you will have to provide more code
Hope this helps
Try deleting the node_modules folder and run npm install in command line at project root directory.
If it still fails, try to run npm install react --save
Recently, I needed to try developing a cordova application. I installed android studio with no problem. Then I went on for Nodejs. I got Nodejs 6.0 installed on my Windows 7 system.
It worked fine. Then I tried to install cordova
with npm command :
npm install -g cordova
It seemed finally ok. The verbose message appeared and the graphical text displayed the folder structure of the installed components, which I thought, this tells me the success install.
When I typed node --version, it showed 6.0.0, the nodejs has been installed correctly.
Then I typed npm --version, it showed 3.8.8. So npm works ok.
After that, I typed cordova --version to validate the installation, it seemed to fetch something for a little while and return the prompt without printing anything or even its version.
I took another try, I typed cordova help. Same thing, there's nothing happen. It just failed or got error somehow silently.
I removed cordova with npm uninstall -g cordova, and tried install again to eventually get the same result. I even tried to remove nodejs and re-install all over again but no luck.
Is there anyone out there faced the same to me? And how did you solve this problem? Any idea?
Make sure this is in your System Path (under : PC -> Properties -> Advanced System Settings -> Environment Variables)
C:\Users\ Your User \AppData\Roaming\npm
Try to close and re-open your command prompt ;)
I've installed Cordova using sudo npm install cordova and set up the paths (I believe) correctly. When I run cordova platform add android I am receiving the following error:
Error: EACCES, open
'/home/millerbr/.cordova/lib/npm_cache/cordova-android/3.6.4/package/.npmignore'
I've been looking at other similar problems, and a few solved theirs using "chown" on the folders relevant to their problem - is there something similar I can do for this?
As it turned out, it was indeed a permissions issue. Running sudo chown -R $(whoami) ~/.npm seems to be allowing me to progress
I've been pulling my hair out for the past two days trying to get cordova to detect and install the android platform for a project.
The specific error:
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
Command finished with error code 8
I have scoured the net for solutions. Here is the .bashrc file:
export ANDROID_HOME=~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools
export ANDROID_SDK_HOME=~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools
export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/tools
export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools
I get the error when running this command:
sudo cordova platform add android -d
Any help would be appreciated!
More Info:
If I run the "android" command, I get the SDK app startup, so I know that works. Ive also installed the latest builders, tools for the SDK.
After a lot of trial an error, it seems the issue was "sudo" all along. Sometimes it's the simplest things that we overlook.
There were also some unnecessary lines in my export commands. The following is all you need:
export ANDROID_HOME=~/adt-bundle-linux-x86_64-20140702/sdk
export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/tools
export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools
If you get an error that ANDROID_HOME does not exist, change the location to use the absolute path. ie: /home/user_name/....
My project directory needed to be 777, as well.
Finally, make sure you run the following command:
sudo apt-get install lib32stdc++6
Looks like without it, I get build errors.
Hope this helps anyone else in the future. There definitely was not enough clear answers on the web, before.