Cordova - Adding plugins results to my code getting deleted - javascript

Pretty straight forward as what the title suggests.
I have a cordova app that i'm writing (cause I'm trying to learn it) with an android platform. I'm using android studio to do the editing. One funny thing is that every time I add a new plugin, the code gets reset to the beginning.
Does this have anything to do with the www at the root of the project? I have 2 "www" folders. One at the root of the project and the other inside platform/android/assets.
Note that I am editing the one under platform/android.

If you use the command line for building and running the app, the root www-folder and some other things, like icons, splashscreens, are copied to the platform folder(s). So this folder will be overridden.
The faster way for developing an app with cordova is to have a symlink from the root www-folder to the www-platform-folder.
I do the coding with PhpStorm, it has a better support for JS/CSS and HTML than Android Studio and do the platform specific things like building, running and special settings in Xcode and Android Studio.

Related

How to integrate Ionic 4 + AngularJS (1.7.2) + Webpack + Cordova?

Ionic 4 CLI is seems to be friendly only with Angular7. And Angular7 is slow like.. send for compile and go take a shower and back and maybe the bundle will be ready. Actually the worst framework the front end ever met.
AngularJS is probably the best happened to front end world. Everything is fast, reliable, straight forward. When you combine this with Webpack you can enjoy an high level of programming language including exports and imports and classes and and components just everything else you need.
However, the Ionic CLI doesn't integrated with something else than the Angular7.
So I have tried to create a cordova based project using:
cordova create test
And then tried to "manually" setting things up.
I have installed Webpack in the cordova based project so now it's accessiable through the node_modules folder. Then I have created the webpack.config.js file in the same directory.
Then I have created src directory which stores the webpack.entry.js file. The webpack.config file reads what the entry file created and creates a new folder called www and there it places index.html file and bundle.js.
Then I am trying to run cordova run --device with Android device connected and the app is getting actioned in the actual device.
Very nice.
However, I have some issues: it seems that the files that are in the bundle doesn't going to be work since angularjs is not completely served.
I mean, in order to serve an angularjs app you probably need a static server or serve it via node. In this case this doesn't happening so it just like drag the index.html file to the Chrome browser and have it not working at all.
I have searched tons at Google but found just nothing.
Is there any boilerplate working with Cordova + Webpack + AngularJs + Ionic framework's components, working fast with livereload?

Could not load file or assembly SQLite.Net, Version=3.1.0.0

I'm working on C# UWP project for Windows 10 Desktop Applications,
all SQLite. Functionality implemented in Windows runtime and windows class library then attach windows runtime references to Win Js project up to working fine. While I'm trying calling those methods create a database, insert records into JavaScript applications getting below error:
System.IO.FileNotFoundException: Could not load file or assembly
'SQLite.Net, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null' or
one of its dependencies. The system cannot find the file specified.
I guess you are using SQLite.Net-PCL. If so, you need to install the SQLite support for UWP. You can find it by Universal Windows Platform section of This Page.
After reinstalling the Vsix file, restart your visual studio and add reference to your RuntimeComponent by add reference->Universal Windows->Extensions->SQLite for Universal Windows Platform.
If the problem still persists, you can try remove the nuget package and add the dll references directly. There are two dlls you need to reference. You can find them under:
C:\Users\<username>\.nuget\packages\SQLite.Net.Core-PCL\3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll
C:\Users\v-xucxia.FAREAST\.nuget\packages\SQLite.Net-PCL\3.1.1\lib\portable-win81+wpa81\SQLite.Net.Platform.WinRT.dll

How can I get a Cordova project template working in Visual Studio 2015?

I want to try my hand at a Cordova based mobile app. In Visual Studio's project templates, under Other Languages->JavaScript, there was an option to install the Cordova templates. I ran that, and after a lengthy install, the JavaScript template folder is gone, and there is a new TypeScript project template node, with one Blank App (Apache Cordova) template.
When I chose that template, I get an error message that says:
The template specified cannot be found. Please check that the full
path is correct
This is giving me the probably wrong impression that in VS2015, support for mobile development has only been given lip service, and there is probably a vast amount of DIY work required to get anything done.
What could be wrong that VS is telling me a template that it just installed is missing? I have a default setup of VS2015 with all default folder settings etc.
I had the same issue after installing update 2 of Cordova. I didn't want to do a 7gb update so I unchecked the Windows 10 related cross platform components as I was only interested in the Cordova update.
To fix the issue I installed all the options back into Visual Studio 2015.
I then received a new error when opening a Cordova Project. I looked in the ActivityLog of Visual Studio "SetSite failed for package [ApacheCordovaToolsPackage]"
To fix this issue I delete the ComponentModelCache of VisualStudio
"C:\Users[your user account]\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache"

Setting up PhoneGap on Eclipse

I've been following tutorials to set up a PhoneGap project (Android) on Eclipse, I'm fairly new to JS frameworks so I'm setting it up to start learning how to use them. In the tutorial (and any other I watch), they use an older version of PhoneGap that includes a .jar file and that isn't present with the latest version. I'm guessing it will still be easy to do but I'm just missing something obvious.
Is there another way to set it up now? Or do I simply not need this file? Thank you for any help.
The Documentation specifically shows how to open up the project in Eclipse.
Use the cordova utility to set up a new project, as described in The Cordova The Command-Line Interface. For example, in a source-code directory:
$ cordova create hello com.example.hello "HelloWorld"
$ cd hello
$ cordova platform add android
$ cordova build
Launch the Eclipse Application.
Select New Project menu item.
Choose Android Project from Existing Code from the resulting dialog box, and press Next:
Navigate to hello, or whichever directory you created for the project, then to the platforms/android subdirectory.
Make sure both hello and hello-CordovaLib projects are selected to be imported. The hello-CordovaLib project is needed as of Cordova 3.3.0 because Cordova is now used as an Android Library instead of a .jar file
Press Finish.
This is all in the documentation.

What HTML files should be edited in cordova?

I have seen a few references to this topic, but it's not 100% clear to me.
Inside the top level of a cordova project you have these folders '.cordova', 'merges', 'platforms', 'plugins', 'www'. I would think you edit the top level 'www' folder and it would update the files inside platforms\<platform>\assets\www because editing files directly in this path get overwrote, from what I have read and I experienced this once before deploying an app.
I can't find documentation on this (searching cordova update project just covers updating cordova itself, at least from what I am seeing maybe I'm being blind here).
How do the files in the root 'www' update the project files? I am sure there is a command for this but is it true I have to run an update command every time I make an edit in say Dreamweaver, because when I make an update it obviously doesnt make changes into the directory because it doesnt have anything telling it to.
So what I am asking.
You should edit the html/css/javascript inside the cordova projects root 'www'?
What are some solutions to updating the platform code from the main files?
Edit the content of www folder in main project directory and run cordova build command to copy these files to your platform specific directories. So the process will be like
Edit the content of www folder in project directory.
Debug the changes with any browser or emulator like Ripple.
Run cordova build command to test it in Android emulator or in a real device.
To use cordova command line tools, you need to install cordova command line interface. It can be found here.

Categories