I am trying to build an android app using Cordova. When I try to add any platform to the project , it gives a weird message
"lokesh#algo1:~/hello$ cordova platform add android
Unable to fetch platform android: Error: EACCES, mkdir '/home/lokesh/tmp/npm-20721-
vboL12Ej'
I have tried for more than two hours searching to the extent possible but didn't find any thing useful.
Please help me .Below are my attempts like exporting proxy , paths .....
Related
I am trying to create a mobile application from my angular app and am using cordova for converting the web app to mobile. I had followed all requirements given on the apache cordova official guide and installed Android studio as well using this online guide.
I had also followed this youtube tutorial which explained to easily convert the angular app into a cordova application using these steps:
- Create a cordova project within the angular project using cordova create <proj_name>
- Create a soft link, adding a link between www folder in cordova project and dist folder of angular project
- Create build
- Add android to cordova project
- Cordova run android
Everything goes fine until cordova run android where it gives me the following error:
Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
I checked to see on stackoverflow of any errors and there were in fact a few similar issues, which should have been resolved by editing the ~/.bashrc file and adding:
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
However, even after logging out and logging in again, several times, using source ~/.bashrc as well hasn't helped, the same error keeps popping up. I have also installed android studio and checked all paths the Sdk is installed and shows on the Sdk Manager in studio.
If I try to enter android in terminal it gives me an unknown command error, same goes with sdkmanager.
when I run echo $ANDROID_HOME it gives me the correct path:
/home/username/Android/Sdk
when I run cordova requirements it gives me the following:
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
android: Command failed with exit code ENOENT
Gradle: installed /opt/gradle/gradle-5.2.1/bin/gradle
Some of requirements check failed
running cordova platform version android in the project gives the following:
form version android
Installed platforms:
android 8.1.0
Available platforms:
browser ^6.0.0
electron ^1.0.0
ios ^5.0.0
osx ^5.0.0
windows ^7.0.0
I do not understand what seems to be missing? I have looked several times but can't seem to find the problem with my installation. Am i doing something naive here?
For anyone facing the same issue: For some reason data was being fetched from npm cache. To clear it, simply:
sudo npm cache clean -f
Maybe not the best approach, but for now it was the only way out
I'm trying to make an apk of the web app I made in babylonjs.
From my understanding you can use Cordova to convert a web app into an apk.
I was able to install Cordova and make its hello world apk download to my phone and open and run it just fine.
However my problem occurs when I put all of my web app files into the www folder in my Cordova project folder. After I do that Cordova gives me this error
Error: ENOENT: no such file or directory, stat '/Users/dylan/practiceApk/www/node_modules/.bin/nopt'
when I try to build the android version.
Here is some information about my setup I believe is relevant.
OS: Mac
cordova -v: 7.1.0
Cordova requirements:
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-26,android-24
Gradle: installed /Applications/Android Studio.app/Contents/gradle/gradle-4.1/bin/gradle
cordova info also gives this error(similar error I believe to the one above):
Error retrieving Android platform information:
Android SDK is not set up properly. Make sure that the Android SDK 'tools' and 'platform-tools' directories are in the PATH variable.
Error: android: Command failed with exit code ENOENT
But I tried a lot of different things to fix this. Most of them involved making the android tools in the path (er something..?) I also downgraded from the most recent version of Cordova and android. I believe the problem is in my web app node_modules/.bin/nopt
But I don't know why its is a problem.
Also im not sure how this affects it, but I'm not hosting the website anywhere I just assumed I can used Cordova to create the web app as an apk that could be used offline, all resource are in the project folder though.
Any ideas on how to fix this? I only started using Cordova today so I don't know much about it.
Thanks for your time!
Update: I tried building an iOS version and I get the same error. I believe this is an issue with my npm setup...
It seems that when I was copying over my project to the newly made Cordova project folder I also copied the node_modules folder and didn't actually initialize npm. After initializing it and then updating it would build the app.
cordova android has some issues and not sure how to solve it.
I have updated my cordova to the latest cordova#7.1.0 and my node to node8.2.0
but each time i try to build my ionic cordova project i get two errors
when i try to build my android project ionic cordova platform add android
Error: Source path does not exist: resources/android/icon/res/mipmap-hdpi/ic_launcher.png
Also when i try to run ionic cordova prepare i get the following error
Unable to load PlatformApi from platform. Error: Cannot find module '/platforms/browser/cordova/Api.js'
Error: Unhandled "error" event. (The platform "browser" does not appear to be a valid cordova platform. It is missing API.js. browser not supported.)
Kinda confused on these two errors and not sure how to solve them.
I am building an Ionic3 project.
Any help is appreciated
I am working on an application which uses Cordova to establish a Bluetooth connection between an Android phone and an Arduino. I am using the BluetoothSerial library in my application.
Whenever I execute cordova build android, it throws an error saying that it cannot find Gradle in my Android SDK installation. In an attempt to solve this, I installed Gradle through Homebrew, but Cordova did not find it.
WT0892:counter iosdev$ cordova build android
ANDROID_HOME=/Users/iosdev/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: /Users/iosdev/Library/Android/sdk/tools/templates/gradle/wrapper
How can I install Gradle into my Android SDK? If that's not the right way to fix this problem, how can I tell Cordova where to find Gradle?
I am new to ionic. I am able to install ionic and also create a new project based on this link http://ionicframework.com/docs/guide/installation.html.But when I try to add a platform it says failed with exit code ENOENT.
I tried to yield debug information by "ionic -d platform add android" as suggested in https://stackoverflow.com/a/32360435/5820057.
I got this msg.
What does it mean? "Failed to find bower component 'android'". Is there any issues with the CLI version?
Android on OS X note gives you an error, searching it;
typing "?
Make sure JAVA_HOME is set, as well as paths to your JDK and JRE for java in browser tab" will result in cordova based errors.
means ionic is wrapper around cordova, so most probably cordova will give you the exact error.
Also make sure all required variable are available in PATH.