How to solve the problem with sqlite in cordova? - sqlite

I'm moving the electron project to cordova. To work with sqlite I use NPM plugin sqlite-sync. In electron it worked perfectly. After porting the sources and installing the dependencies, I see an error when starting the project.
ERROR in ./node_modules/sql.js/js/sql.js
Module not found: Error: Can't resolve 'fs' in 'D:\PROJECTS\PRODUCTIONS\MOBILE\\node_modules\sql.js\js'
# ./node_modules/sql.js/js/sql.js 3:1275-1288 3:170484-170497
# ./node_modules/sqlite-sync/sqlite.js
# ./src/store/index.js
# ./src/main.js
# multi ./build/dev-client babel-polyfill ./src/main.js
how fix problem? win platform

Electron and Cordova are not the same, Electron implements the NodeJS API while Cordova uses its own API. If you want to use SqlLite in cordova you are going to have to rip out the parts that use NodeJS (if you see the word 'require' it is probably a node import -- in fact to make life easier on yourself use ES6 imports with WebPack or Browserify so that you know which code to rip out). You may be able to use a lot of node_modules with a modern build system but it is going to be a fair bit of work to move from Electron to Cordova. If you want to use SQLite, the SQLite Cordova Plugin is probably the easiest way to do this, but it is going to look a little different from the NodeJs Sqlite API.

Related

React Native and using npm modules

So this is the case: we developed a web application. Now we are developing an app in React Native with Firebase, for iOS and Android... Is there a way to make use of the npm private module that we developed for the web application? Do we need to initialise firebase/app as well in typescript? Or is it really needed to develop a seperate module for android and a separate module for iOS?
So in this npm private module there are standardized ways for our company to get and set data in firestore.
Regards, Peter
As far as I understand it, every package from npm is mapped or linked to one in the respective operating system, that is Android and iOS in your case.
Is there a way to make use of the npm private module that we developed
for the web application?
Or is it really needed to develop a seperate module for android and a
separate module for iOS?
When there is no respective implementation for the operating system, that "translates" your npm package, it will not work.
Do we need to initialise firebase/app as well in typescript?
Yes indeed, also in react native you need to initialise firebase app.
So in this npm private module there are standardised ways for our
company to get and set data in firestore.
I cannot say why you did this in a custom way, if you use the "normal" firestore methods then maybe there is still a way to reuse some code? But that is hard to say from the outside.

Firebase Crashlytics NDK unstripped files

I have an SDK that uses C++ code. The SDK exports 4 different modules in a maven repo that I publish on either a local maven repo or on GitHub packages.
The apps that consume the SDK should be able to use Firebase Crashlytics and get reports of crashes in the native code as well.
The first problem I have is that I need to provide to the Firebase plugin the folders unstrippedNativeLibsDir and strippedNativeLibsDir:
firebaseCrashlytics {
nativeSymbolUploadEnabled true
unstrippedNativeLibsDir "???"
strippedNativeLibsDir "???"
}
If I go to the project where I build the SDK I can see: build/intermediates/merged_native_libs/release and build/intermediates/stripped_native_libs.
Are these the unstripped and stripped folder respectively?
Is there any documentation about what exactly those folders are supposed to contain?
Anyway if I configure the app firebaseCrashlytics to point to these folders I still need to fix another issue.
I get:
Crashlytics could not find NDK build tasks on which to depend. You many need to manually enforce task dependencies
It looks like since I'm building the libs that use the NDK in another project, then the Firebase plugin does not work.
What am I supposed to do?
Is it possible to get the Crashlytics NDK working even if I build the libraries independently with a separate project?
The only way I made it work was to build the libraries along with the app. The libraries were in separate repos anyway but I included them as sub-repositories in the app.
In this way, you solve the issue of not finding NDK build tasks on which to depend.
I know this is not the answer though

Issues embedding Firebase inside other framework

We have our own swift framework REFFramework that is using carthage to import Firebase (analytics and firestore). This is the cartfile in REFFramework:
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json"
The REFFramework is used in the app also using carthage to import it.
In addition the app itself also imports other modules from firebase (remote config).
This is the cartfile of the app:
git ".../REFFramework"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseRemoteConfigBinary.json"
As far as I know carthage is designed to fully support this kind of structure. We use other frameworks also embedded in REFFramework like this such as Alamofire.
However we notice a crash in the app that does not happen when we remove the Firebase out of the REFFramework.
So it's clearly todo with the embedding of Firebase in an intermediate Framework.
The crash is happening in "0 __pthread_kill", here is a screenshot of the debugger in xCode 10.3:
I see a remark in the documentation:
Note that the Firebase frameworks in the distribution include static libraries. While it is fine to link these into apps, it will generally not work to depend on them from wrapper dynamic frameworks.
Not sure if this is releated to this issue?
Yep, the Firebase Carthage frameworks include static libraries and can only be linked to other static library frameworks.

Webstorm doesn't see Meteor packages

I have Webstorm 11.0.1 and Meteor 1.2.1.
I have an issue with Kadira:flow-router not being shown in external libraries and therefore Webstorm is painting red all the references to the FlowRouter API.
The Meteor app itself is working fine. The problem is with IDE only.
There was a similar issue with another API:
Webstorm doesn't see API
However I was able to use the a o3 package.
It is a bug of Meteor import system in WebStorm. The problem will be fixed in WS 11.0.2.
As workaround you can manually create external library for the directory:
"$USER_HOME/.meteor/packages/kadira_flow-router/2.9.0/web.browser".

Generate apk file for meteor app

I have a project is working for android browser. Is there a way to generate the apk file?
Also, are there anything that I shoud know before generating the apk file?
There are a few steps to follow in order to generate the Android application file (.apk) from a meteor app:
meteor install-sdk android
Have the mobile-config.js file in your project root (mobile-config.js example)
meteor add-platform android
meteor build ~/your-output-dir --server=yourapp.meteor.com
Then you will have your .apk file in ~/your-output-dir/android/unaligned.apk
If you want to proceed and submit to Google Play Store, here are the steps to follow: https://guide.meteor.com/mobile.html#submitting-android
Hope this helps!
You can build an APK file with meteor build command.
Read more about it in the docs: http://docs.meteor.com/#/full/meteorbuild or by typing meteor help build in your terminal.
Starting with Meteor 1.2, the bundled Android tools have been removed and a system-wide install of the Android SDK is now required. This should make it easier to keep the development toolchain up to date and helps avoid some difficult to diagnose failures. The meteor install-sdk command no longer attempts to download and install the Android tools for you (it has been deprecated and just points you to these instructions).
like imslavko says, meteor build works pretty fine, also if you are looking for more information take a look on this Meteorpedia
It work for me
Reegards
As of now playstore has started giving warning while uploading APK about unoptimised bundle and insisting for uploading Android app bundle.
Insted of generating APK why not generate .aab of your project and reduce size of the application.
For people wondering about how to generate .aab for your existing project can read my blog here:
My blog link

Resources