Replace all your files indented with 4 spaces to 2 spaces
sed -e 's/^/~/' -e ': r' -e 's/^\( *\)~ /\1 ~/' -e 't r' -e 's/~//' -i *
sed -e 's/^/~/' -e ': r' -e 's/^\( *\)~ /\1 ~/' -e 't r' -e 's/~//' -i *
If you have a Cordova Error after updating to Ubuntu 18.04, the easiest way to resolve this issue is removing openjdk-11 and reinstalling openjdk-8.
sudo apt purge openjdk-11-jdk-headless openjdk-11-jre-headless sudo apt install openjdk-8-jdk
There is not support for the new java versions yet in Cordova/Android (at the post date)
chromium-browser --disable-web-security --user-data-dir=/tmp/something
in your terminal to allow all origins (temporary ignore CORS mechanism )
Note: Use Chromium without security just with your own code for testing and development, do not browse with it and beware about using third-party software in your code.
create-react-app MY-WEBSITE
This will create a react app with everything configured.
npm start
npm i -S i18next
This will let us do our website/app internationalization.
Create a i18n.js file in the src folder with this code:
import i18n from 'i18next'; i18n .init({ fallbackLng: 'en', lng: navigator.language.split('-')[0], debug: true, resources: { en: { translation: { "Hola": "Hello", "Adiós": "Bye" } } } }); export default i18n;
Import your i18n.js and use its t function to indicate where it should be the internationalization.
import React, { Component } from 'react'; import logo from './logo.svg'; import i18n from './i18n'; import './App.css'; let t = i18n.t.bind(i18n); class App extends Component { render() { return ( <div className="App"> <div className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <h2>{t("Hola")}</h2> </div> <p className="App-intro"> To get started, edit <code>src/App.js</code> and save to reload. </p> </div> ); } } export default App;
Which is the easiest way of builing apps in Android with Cordova?
Use a build.json file
{ "android": { "release": { "keystore": "./your_keystore_file", "storePassword": "your_keystore_password", "alias": "your_alias_name", "password" : "your_alias_password" } } }
And type in your console: cordova build android –release
If you already have a keystore and don’t know what alias to use, run the command: keytool -list -v -keystore YOUR_KEYSTORE_FILE to see all the available aliases.
Keystore only has one password. You can change it using keytool: keytool -storepasswd -keystore MY_KEYSTORE
Note: I’m locating my build.json and keystore_file in my project’s root folder.