Cordova build erases all app files - android

I have some problem with building an app with cordova. This is my first experience with that software.
I have an existing Android HTML/JS app. I want to do some changes to it, re-build and test it in emulator.
App's files are located in platforms/android/asset/www, I can see them, edit them etc.
Now, after doing the changes, I do a "cordova emulate". I see it builds my app, the emulator starts and… it shows me a Hello World app.
All app's files from asset/www disappeared, and are replaced with "blank", hello world files , like I would just create a new app.
Why is this happening? How to prevent it?
My current cordova version is 4.3.0. The application was probably made and last edited on some older version (few months ago).
Found a similar problem here link but there's no solution there.

Instead of working on the platforms/android/asset/www you have to work on the root www folder, when you run the app the files will be copied to platforms/android/asset/www

Related

Files appear in the Android/Data/{appName/} folder after installation, without starting the app

So I am working on a Android app with Unity, and I use git (gitHub) for source control. The problem is that on my PC when I build the apk and install on a phone there are files in the Android/Data/{appName}/Files folder. That's a unexpected behaviour because I want to copy files there but only after starting the app. The interesting thing is that if I clone the repo and build the apk on my laptop it works fine, the files are only created on my phone when I start the apps and my own scripts copied them.
So my question is there a gradle or any build system configuration for this kind of behaviour? (I am not so familiar with gradle)
So basicly I tried going trough my git ignore list to find what can be the difference (the unity provided default on), but no luck.
Edit: The apks totally similiar, same size, etc
Changing the product name in the player settings solved worked, but I am not convinced the issue is solved.

Ionic app icon doesn't change

I'm building an android app with Visual Studio 15 Community, Ionic and Apache Cordova and I would like to update the icon of my ionic app. I'm emulating the app with Genymotion but I get the same result using the build-in android emulator from VS15.
Additionally, I used a blank ionic project.
I've already tried
I added the source of my icon in the config file (please note that I added the density myself, it has not been generated)
<icon src="resources/android/icon/icon.png" density="xxxhdpi" />
Created the app logo based on this blueprint:
http://ionicframework.com/docs/cli/icon-splashscreen.html
Placed the .png file in the specific folder
I followed the instructions from the ionic and visual studio website
with no results.
I didn't try
Actually, I didn't try to execute the command to update my ressources using $ ionic resources --icon because I think that as soon as I build the app (pressing the play button in VS15) it does all the work for me
Maybe I'm getting something wrong here because usually this isn't a big deal.
I really appreciate all your answers, thank you for taking the time to deal with this!
As of the latest updates. if the splash and the icon did not update. that is because the latest version of ionic creates 2 md5 files of the icon and the splash. which i guess is locking the updates.
just delete these 2 files: “icon.png.md5” and “splash.png.md5”.
then run the following command : ionic cordova resources
then splash and the icon should be updated.
might be helpful to someone out there cheers!!
Density is set to "xxxhdpi" density. Maybe you need to add another screen options?
Try to refresh project, too.
As mentioned earlier by a user whos post has been deleted (why?), all I had to do was to
open my command line
go to the directory in which my project is
type the command $ ionic resources
That's it! Ionic does all the rest
A quick note: I didn't know that I had to install the tools (Android SDK, Apache Cordova etc.) because I thought that Visual Studio downloads them due to the first build so why installing it locally. You must install them locally, it will not work without the tools installed on your machine.
Hope I could help

visual studio 2013 cordova hybrid app plugin: Location of apk file

I was playing with the new hybrid app plugin available for developing hybrid apps using cordova. I used the sample app that they use in the tutorial. Now the documentation here says that every time I build the solution a package is created and here they say that the package gets placed in the bin folder of visual studio project directory. I looked into the folder but there is no apk file present there. I searched the whole project directory still no luck.
Did anybody else face any similar problem? Please help me locating the apk.
You need to select the "Device" option instead of going for Ripple emulator in the test device drop down! It is the one with the green arrow sign.
Now when you compile the apk file gets created inside the bin directory of the solution as mentioned in the documentation.

Deploying Phonegap / Cordova app for Android?

I've got a Phonegap/Cordova 3.0 app that I am testing on Android.
Since version 2.x, Cordova relies heavily on the command-line terminal. I've done all the setup stuff and I can build the app. But two things are troubling me.
First of all, an Android project has two www folders. One is [myproject]/www. The other is [myproject]/platforms/android/assets/www. I'm not sure which of these folders to edit when I am fixing bugs.
If I am correct, the first one is where you place your app files before using the command-line "cordova build" to create the app. The second one should then be only a copy that's used after building, before deploying.
Now my question is, when I make a change to my app and I want to test on device, do I have to use the command line to (re)build the app every time?
[myproject]/www is the directory in which you should put your source files. When you build your app these files are copied in to [myproject]/platforms/[platform]/assets/www. In addition to this, files in [myproject]/platforms/[platform] are also copied to [myproject]/platforms/[platform]/assets/www, which allows you to create per-platform overrides to your files.
Note that you should never edit files in [myproject]/platforms/[platform]/assets/www directly, as they will be deleted next time you build your project.
To run your project on your device use cordova run [platform], or to run it on an emulator use cordova emulate [platform].
I found a solution: in command-line terminal, type cordova run android and the app will be built, deployed and run on device.
Hi First thing : Edit www folder inside the asset folder.
Second : no need of command line build , you can take build via eclipse its very easy, Right click on project root folder --> Run As -> Android Application

Do I need to prevent caching on Android emulator?

I am using PhoneGap to develop cross-device (simple) applications, and I am currently using eclipse with the Android Emulator. The problem I am encountering is that it does not appear like my code changes recently are reflected by the application installed on the emulator. I have tried uninstalling the application from the emulator, cleaning and re-building from within eclipse, but neither of those has worked.
Is there some manual script I need to run to re-install the .apk? I am a newbie at mobile development, so please bear with me. :)
Eclipse should automatically rebuild your application if the option is activated. Take a look for it at Project -> Build automatically
The ADT should reinstall an application if you run the project. Take a look at the console (not LogCat) of eclipse, you should see some information about reinstalling the application (at least thats when you deploy on a device).
If you want to try if a change was successfully made, try to use a log statement that you change as soon as you have the feeling that its not the current version. So you can find out if at least the deploy worked.
If nothing of that helped, we should dig deeper...
I had the same problem (my app did not get updated whatever acrobatics I was doing) until I simply refreshed the Project in Eclipse. The javascript files I am using in the project were edited in an external text editor, the HTML in Dreamweaver, so Eclipse apparently never pulled the renewed files from the file system, even after restart. Doing a refresh took care of that.

Categories

Resources