android dev app not updating with changes on cordova - android

I have seen several questions similar to this, but none of the accepted answers have worked for me. I've tried deleting the apk folder, adding no cache meta tags to the html (which doesn't update anyway), incrementing the android version number, incrementing the app version number, incrementing the javascript file version number in the script tag; I've tried uninstalling the android platform and reinstalling; I've uninstalled the app from my phone repeatedly; I've run cordova clean over and over again, I've tried deleting all the www folders in the platform/android directory. I've even started the app from scratch after a clean install of cordova.
No matter what I do, the changes I make to index.html or index.js do not update on my android phone. Even when it's clear they've updated everywhere in the build files, and the apk has to be recreated because I manually deleted it, my phone pulls up the app exactly as it was on my first test build. Not a single change has ever been updated on the android platform. Except, the version number will change, just not the html or javascript files themselves.
The ios platform updates just fine, as does the browser platform, obviously.
I'm using the cordova cli, no phonegap app, just pure cordova in terminal.
I'm on mac osx high sierra, with the latest android studio.
adb is 1.0.39.
cordova 8.0.
node 9.3.
javac 1.8.0_151.
ant 1.10.1.
homebrew 1.4.3.
update i also just tried removing the index.html and index.js files and replacing them with bare bones, essentially empty files (basic declarations in the html file). I ran cordova clean and then cordova run android --device and the app installed on my android, with the original index files. I.e., still not updating changed content, even brand new files.

Confirmed resolution: after a clean install and a one-by-one addition of my plugins, with html updates in between each plugin install, I've confirmed that the issue was an incompatibility with the android-fingerprint-auth plugin. Without that installed, I get a proper updates on the android app. If I install that plugin and then uninstall it, updates continue not to work. I.e., it does some permanent damage to the app.

Related

How to set proper version control for Ionic project

We're working in an app for Android/IOS and the team has at least 3 people working in the app code and who need to have the app running locally in their particular env, someone is developing over Mac OS to eventually build to iOS and the others are on Windows machines.
We've been experiencing problems with the Ionic project after installing ngCordova, some cordova plugins and the ionic-platform-web-client, the mac machine had the app running beautifully and the windows instances were broken complaining that: Module 'ionic.service.core' is not available!
We don't know which particular step caused the code inconsistency and after several hours of looking around to fix it we decided just to create a new Ionic project and copy our specific www code inside. Since we don't want that to happen again we need to figure a reliable method of keeping all platforms working right after we install a plugin or add an Ionic service.
Could this be accomplished only by gitignoring www/lib folder and platforms, and then running bower install in each dev machine after a new module have been added to the project? or is it more complex than that and we're omitting some important steps to allow the project collaboration without these kind of issues?
Yes, you can put platforms in your .gitignore. I personally wouldn't be putting www/lib folder there, though.
Also, I would strongly advise that on all the machines where you're building the apps locally you have the same version of Ionic and Node.

How do I make Sencha Touch and Cordova work together?

I have a Sencha Touch application and I would now like to package it with Cordova for Android, iOS and browser.
I am trying for about a day now to make the two work together. I can get a version onto my device, but anytime I try to update it with new code something doesn't work. "Something doesn't work" means one of the following: device shows the "3 dots of death" (blinking 3 white dots on blue background) forever OR a browser-style alert saying app.js was updated and should I reload (with cancel/reload buttons) OR a sencha-style alert saying the application finished upgrading and do I want to reload.
I think the root of the problem is the way Sencha (Cmd?) works or the way I fail to comprehend what I'm doing wrong. I seem in misunderstand what the difference between "production", "package" and "native" is. I can understand why "over-the-air" updates can be good, but since this is a local application, I don't need any of that. I don't want/need to have an "archive" folder in my output dir, nor a "deltas" folder. And why does the "archive" folder have extra copies of all my CSSs? ripping out hair
So, I guess my basic question is: how do I make Sencha Touch just build a complete application, without over-the-air updates, deltas, archives, confusing prompts upon launch or the 3-dots-of-death?
While waiting for a discussion to start I'm going to go ahead and keep trying stuff out and report back here with anything I may find.
Final notes:
I am using my own cordova, not Sencha's "sencha cordova" commands. I am confused enough as it is, but maybe I need to try that?
Part of the reason I want a "normal" build with one big Js file without deltas or archives is that I want to send it after compilation to an obfuscation service (jscrambler). Don't know if that's important.
This may be unrelated, but when I'm upgrading an existing installation of my app on an android device, I get the old version of my Javascript (even though the android application itself was updated, I can tell by the version number). I read somewhere that I should remove and add the android platform from my cordova project before compiling... why?
Thanks for your attention, I hope this thread will help any other miserable programmers out there :)
Versions:
Cordova -v = 5.3.3, Sencha Touch (zip) = 2.4.2, Sencha Cmd = 5.1.3.61, Android API level = 22, Mac OS X 10.10.5
The best way to handle this is to just let Sencha CMD do it's thing. It can be done other ways but I'd recommend that after figuring out the basics of Sencha Touch and Cordova
Basically you have a ST project that you can create in CMD.
sencha -sdk ~/path/to/touch-0.0.0 generate app MyApp ~/path/to/create/my-app
Then you do some dev work and you want to do a build in Cordova
sencha cordova init com.mydomain.myapp MyApp
The Cordova directory is added to your project and contains..
cordova
|_ hooks/
|_ platforms/
|_ plugins/
|_ www/
|_ config.xml
So just to explain a little before moving forward -- when you run
sencha app build production
you get a minified version of you app the (compiled to my-app/build/production/MyApp) is deployable to a web server intended to work well as a mobile website/web app.
When you run
sencha app build native
you get almost that same minified codebase but it is compiled to my-app/cordova/www/.
Sencha's build completes completes with putting code into the www folder it triggers a cordova build. Then contents of the www folder are copied to each platform/[os]/www directory.
If you make any changes to your project specific to the cordova build you would want to do that in the cordova/www folder (be careful as you might get changes wiped out)
Sencha CMD's Native build does do some custom things to the index.html to cooperate with Sencha better, but a good deal of it is pretty normal to Cordova. If you CD into cordova you can actually run the normal cordova [options] commands. The difference there is the any changes to your Sencha project is not copied into the Cordova project.
#1
I would recommend using the Sencha CMD route as it will make life easier.
#2
You shouldn't need to use a third party tool to do anything with your JS as it is done through uglification in the build.
#3
I could be wrong but my first guess is in a stand alone Cordova project the platforms code does not update unless you run
cordova build
I think this might cover your issues but if not I can try to clarify anything.
EDIT I am using iOS in my examples but swap that with android. Habit :/
The workflow I normally use is to have a build script (or you could use a Cordova build hook) to package the Sencha Touch JS app code with Sencha cmd and copy the results of that into the Cordova project's www folder, prior to running cordova build.
I'd recommend using your own Cordova not the one tied to the Sencha tooling, it's easier to stay up to date with the rapidly moving Cordova project like that.

Cordova (android) deploy issues

I am a newbie on using cordova (or phonegap), I was doing some demo projects and found a strange problem on deploying the projects on my android phone (Nexus 5)
when I run: "cordova run android"
everything seems fine and the app is installed on my phone as well, however, I found that after successfully installing the app, the EARLIER installed app /demos (created by cordova as well) was removed!!!
I was wondering if it was related to any platform dependent settings on android? It seems that no matter what the built apk's name was, it would eventually uninstall the already installed cordova apps; by then the new cordova app would be installed (sort of like file copying and the new file would overwrite the existing file -- assume same file name)
Anybody got clues on this???
Jason

development workflow for managing cordova plugins in your phonegap project

I'm trying to compile a phonegap based app using different development machines - think multiple developers with their own machines and/or different machines to build different platforms.
The application was first compiled on PC for android which works ok, but when I try compile on Mac for ios, some of the app functionality is missing. I can confirm that other applications are able to be built on the same Mac for ios, so it's not an xcode related issue.
My .gitignore includes things like node_modules/, www/, platforms/, app/lib and plugins/ and when I run npm install node_modules gets populated, and when I run bower install app/lib/ gets populated and so on.
As per this post I then proceed with manually creating directories www/, platforms/ and plugins/ which then allows me to run grunt platform:add:ios. I can then emulate and/or deploy successfully, but when testing, functionality in the app is missing.
The problem seems to be that the plugins/ folder doesn't get populated. I can manually run cordova plugin add <plugin> for each cordova plugin and when building and deploying the missing functionality shows up but the process seems a bit inefficient and prone to error if someone forgets to add a plugin.
Various guides have suggested running cordova prepare ios but this doesn't seem to do much.
This blog post by Josh Bavari suggests some hacking around to automate the process, and this post talks about something similar but they're half a year old now.
Am I missing something obvious here, or is the manual cordova plugin add process a normal part of dev workflow? Cheers.

Difference between PhoneGap and Cordova and which one should we install?

I have been tasked with developing an Android and iOS application with PhoneGap (http://phonegap.com/)
However, as I read, things start to get really complicated: Some people say Cordova (http://cordova.apache.org/) is now PhoneGap, others say PhoneGap is just a distribution of PhoneGap.I lost 3 days and still can't find a proper way or a guide to install a fully functional PhoneGap plugin either in Eclipse or Netbeans running Ubuntu 12.04 64-bit.
What I tried:
1. Installing Eclipse, installing MDS AppLaud Phonegap Plugin (http://marketplace.eclipse.org/content/applaud-phonegap-android-jslintjshint#.Utf1JPiSTh8). This one actually installed at once, and it actually lets me create a new PhoneGap project in Eclipse, however, the I cannot select any SDK different than 4.4. (?!)
2. Installed NetBeans and after I tried to install phonegap and cordove through nodeJS it failed, again.
My question is:
Which one I should install and how to do it in Ubuntu, using either Eclipse of NetBeans?!
Edit:
OK guys, I just found out how to install nodeJS and PhoneGap on Ubuntu 12.04: http://paste2.org/1OnX6M6F . Still trying to integrate it in some IDE for the real thing, though!
If you want to basically start developing an app, I suggest this for PhoneGap:
These are the steps I used to install PhoneGap on Ubuntu. Take note, this is for PhoneGap version 2.8.1. Personally I was not able to get nodeJS to install the latest. If you need the latest to be installed, check around on google. Referencing This tutorial.
Step 1
Install Java 7 JDK
Step 2
Install ANT
Step 3
Download & Extract PG v2.8.1
Step 4
Download Android SDK
Step 5
Set up environment variables
Step 6
Create base project
./create location/to/put/project package_name project_name
Step 7
Import Project into Eclipse
File->New->Android->Android Project From Existing Code
Browse to where you placed the project and select it
Now you can start developing.
Reminder: This is the way to do it for v2.8.1 of PhoneGap. Different versions(especially 3.*) will be different (nodeJS)
Look at http://docs.phonegap.com. Read the "Overview chapter, then "Platform Guides" and "The Command-Line Interface". Follow the steps and in the end you should be able to build your app. It takes a while but it's worth it.
I havn't integrated cordova/phonegap in my IDE. I just created the app with the command line interface. In netbeans I created a HTML5 project and linked the app-root/www directory into this project. I'm programming with Netbeans and building and running the app with the command line interface. That's all.
In order to have some code completion, I have written an extra class (facade) which encapsulates the phonegap code. It just delegates its calls to the phonegap API. That is especially nice if the phonegap API changes as it only affects my code in that particular facade class.
The last thing I want to share: I found out that the build and run process with the command line interface is pretty slow. Executing cordova prepare android and then running the android project in Eclipse/ADT is a lot faster.
OK, to put it simple:
PhoneGap - The original project developed by volunteers
Cordova - The Apache's version of Phonegap, which has exactly the same documentation and functionality as the original PhoneGap but is integrated in NetBeans 7.4.

Categories

Resources