When I serve my project there is no problem, but when I build it for android it fails.
It even fails to load its fonts: E/AndroidProtocolHandler: Unable to open asset URL: file:///android_asset/www/assets/fonts/roboto-bold.ttf and gets stuck on splashscreen.
When I change asset path from ../assets to /../../assets or ./assets it loads, but fonts and background images are still not found.
I'm using the latest version and the default assets folder in src
Solved
Now after reinstalling cordova etc I tried a blank project - It works.
1) In my scss I had:
$assets: "../assets/";
$font-path: $assets+"fonts";
Looks like android did not like that (but I added it later)
I removed android platform + cordova
deleted package-lock.json and node_modules
ran npm-check-updates just in case ran `
ran npm install
added back cordova and android platform
deployed to android
There are some bugs, but images are now showing
Related
I use Cordova 8.0 and it is my www project tree:
When I run cordova run android for test my app in my phone I get the next project tree:
(I show it thanks to Chrome Dev Tools)
So cordova completely omited my fonts folder How can I avoid it?
EDIT:
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.
I am trying to create a basic ionic project. I have used the command
ionic start myProj blank to create myself a blank project. I am referring to a tutorial where is shows that the www folder should have css, js and other folders in them. I don't see ay in my project structure.
I have tried reinstalling ionic. Did not help. Currently I have installed
Ionic - 2.2.3
Node - v6.10.2
I am using Atom editor to view and edit the contents
ionic start mproj blank will create files in src directory..
www folder will get files once you build for eg: ionic serve.
This will have build folder containing transpiled and minified css and js files.
ionic has changed considerably from 2 to 3.x.. Your code should work with minor changes if it is old tutorial..just compare with official docs
I am developing an Android app using Apache Cordova 3.6.0.
I have followed the instructions available here and here to create, build and run my app.
I realized there are two folders which store HTML, CSS and JS files: www and platforms/android/assets/www:
According to this answer, I should modify only www because the command $ cordova run android will overwrite platforms/android/assets/www.
When I run my app through ADT, the folder platforms/android/assets/www is not updated.
How can I make ADT update this directory? What am I missing?
The linked answer is correct. You should only modify the content of the root www folder.
But you will have to build your app before you run it to make your changes take effect in the platforms/android/assets/www folder by running:
$ cordova build
or cordova build android.
FIRST SET OF WWW folder:
it contains your customized file ,from which you are developing the application.U must make the changes here.
SECOND SET OF WWW folder:
these are generated when u install a plugin with sample.(A working example)
I have tried using Cordova 2.4 & 2.7 to no avail. The project seems to build fine when using the create method in console, except it does not create the whole program structure. The www folder is missing (or assets?).
When I open the project in Eclipse, I can see the assets folder on the left sidebar pane, but there is no children (it is empty).
The default app builds and runs fine (it just says "Hello World, App").
I should note that I tried this in cygwin also, and it came up with an error.
An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1
Deleting project...
I am using Windows 7 x64 with Eclipse 4.2.2, Cordova 2.7 (also tried 2.4). I have the ADT plugin installed on Eclipse, and here is a screenshot of my SDK manager.
I have the entries in my PATH variable set that I followed in the Getting Started tutorial.
If anyone has some input or ideas in how to resolve this, it would be greatly appreciated!
Hey If you are creating a project then you have to create a assets/www folder etc,You have to make changes in other files too.
Follow the link below you have all the information you need
http://www.adobe.com/devnet/html5/articles/getting-started-with-phonegap-in-eclipse-for-android.html
Be sure to change the cordova version etc,as per your requirement.