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.
Related
Long story short, I've tried all sorts of solutions SO and other sites have proposed, and I'm certain none of them handle my scenario. I'm using Cordova to build my apps. I recently reinstalled Cordova, and apps stopped building.
Yes, I've installed and included gradle in my path (I'm on Windows)
I've verified and gradle is installed (gradle -v) from command prompt
When I open the project directly from Android Studio, it finds gradle and builds successfully
When I use cordova to run it from the cmd, I get the above error
Funny enough, when I delete downloaded files from C:\user\.gradle as some SO and GitHub solutions suggest, it downloads gradle, and after completing the download, still tells me gradle couldn't be foound
I've upgraded Node, NPM and Cordova to their latest versions. If it's of any help, I'm building on Ionic and both Ionic and Angular have been equally upgraded to their latest versions. Ionic serve and every other related command works. Here's the command that triggers the error:
ionic cordova run android
You should ensure the path of the gradle installation is exactly the same path you are setting in your environment/path variable.
That solved it for me
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 am new to ionic and android development.I have created a sample HelloWorld application which works fine in the browser when I try to generate the unsigned APK I am facing the following issues Build Issue Ionic Image Link.I have installed latest android SDK via android studio.These are the screenshots of installed SDKs Installed SDKs Image Link.I have also tried to modify the environment variable Android_Home path to 'C:\Program Files (x86)\Android\android-sdk\build-tools'.Still facing the same issue.
FYI: I am using Windows as my development environment.
Ionic thinks your Android SDK is at the file path 'C:/Android' because it found adb there. It's definitely not there because 'platform-tools' isn't there. Try deleting that file (or folder if you don't need it) and changing your ANDROID_HOME path variable to the location that Android Studio says your SDK is at. If you navigate to that folder yourself you should see a 'platform-tools' folder there.
My cordova version is out of date and I am receiving an error on google play that I won't be able to upload an app unless it's been updated. Well, I updated my cordova version in my OSX terminal and I'm currently running 5.2.0. When I check my project's cordova directory, it says it's at VERSION = 3.4.0.
How do I actually update the cordova version in my app that has already been built? I thought the correct command was cordova platform update android when I go to the specific directory. However, I'm receiving a "current working directory is not a cordova-based project" error.
Below is my directory; I have tried using just my main directory and also /cordova and /CordovaLib with no success. Can anyone help?
I am trying to create a phonegap / cordova app using the 3.1.0 version.
Created my app with the command:
cordova create hello com.example.hello HelloWorld
And after running this command:
cordova platform add android
to add android platform, i am getting:
[RangeError: Maximum call stack size exceeded]
Any idea what could be the issue?, previously i created another app, but same error was occurring when adding camera plugin.
I faced the same issue, but I was actually issuing the command in wrong directory, so firstly I changed the directory to Hello then issued the command.
So, I have directory structure as,
---Cordova
---Hello
and I was actually issuing the command by being at Cordova folder. After that I changed the folder to Hello then executed this cordova platform add android and it worked.
Please check once
be sure you are located in the created directory (Hello, I guess), the same level with .cordova
cd Hello
For anyone coming to this question after July 2013 (when Cordova 3.0.0 was released), there is another reason for this problem.
If you created a Cordova project on a computer with Cordova 3.x and you are trying to work with it on a computer that still has the old 2.x version, you will get this error because of how the project structure changed between the versions.
Upgrading Cordova to the newest version using npm install -g cordova will fix the problem.