|
|
[https://ionicframework.com/ ](https://ionicframework.com/)
|
|
|
<https://ionicframework.com/>
|
|
|
|
|
|
\##prérequis
|
|
|
<span dir="">#</span>#prérequis
|
|
|
|
|
|
`node --version `
|
|
|
`node --version`
|
|
|
|
|
|
`npm --version `
|
|
|
`npm --version`
|
|
|
|
|
|
`sudo apt install npm `
|
|
|
`sudo apt install npm`
|
|
|
|
|
|
`npm install -g @ionic/cli`
|
|
|
|
|
|
\[optionnel\] Upgrade node version (version 10 installée, besoin de la 12 minimum pour capacitor) le paquet n permet de gérer les versions de node
|
|
|
\[optionnel\] Upgrade node version (version 10 installée, besoin de la 12 minimum pour capacitor) le paquet n permet de gérer les versions de node
|
|
|
|
|
|
`sudo npm install -g n `
|
|
|
`sudo npm install -g n`
|
|
|
|
|
|
`sudo n current // dernière version stable`
|
|
|
|
|
|
`export NODE_OPTIONS=--openssl-legacy-provider`
|
|
|
|
|
|
|
|
|
## installation de ionic
|
|
|
|
|
|
\` ionic start
|
|
|
|
|
|
? Use the app creation wizard? (Y/n) n
|
|
|
|
|
|
Framework: (Use arrow keys)
|
|
|
Framework: (Use arrow keys)
|
|
|
|
|
|
❯ Angular | [https://angular.io ](https://angular.io)
|
|
|
❯ Angular | <https://angular.io>
|
|
|
|
|
|
React | [https://reactjs.org ](https://reactjs.org)
|
|
|
React | <https://reactjs.org>
|
|
|
|
|
|
Vue | [https://vuejs.org ](https://vuejs.org)
|
|
|
Vue | <https://vuejs.org>
|
|
|
|
|
|
\[choix Angular\]
|
|
|
|
|
|
? Project name: = elabTest
|
|
|
|
|
|
? Starter template:
|
|
|
? Starter template:
|
|
|
|
|
|
tabs | A starting project with a simple tabbed interface
|
|
|
tabs | A starting project with a simple tabbed interface
|
|
|
|
|
|
sidemenu | A starting project with a side menu with navigation in the content area
|
|
|
sidemenu | A starting project with a side menu with navigation in the content area
|
|
|
|
|
|
❯ blank | A blank starter project
|
|
|
❯ blank | A blank starter project
|
|
|
|
|
|
list | A starting project with a list
|
|
|
list | A starting project with a list
|
|
|
|
|
|
my-first-app | An example application that builds a camera with gallery
|
|
|
my-first-app | An example application that builds a camera with gallery
|
|
|
|
|
|
conference | A kitchen-sink application that shows off all Ionic has to offer blank
|
|
|
|
... | ... | @@ -61,4 +60,64 @@ conference | A kitchen-sink application that shows off all Ionic has to offer bl |
|
|
|
|
|
Problème la politique « Same Origin » ne permet pas de consulter la ressource distante située sur <https://canular.inrae.fr/api/v1/experiments/6>. Raison : l’en-tête CORS « Access-Control-Allow-Origin » est manquant. Code d’état : 400
|
|
|
|
|
|
sur le serveur sudo a2enmod headers |
|
|
\ No newline at end of file |
|
|
sur le serveur sudo a2enmod headers
|
|
|
|
|
|
# Création de l'application, lancement du projet sous android
|
|
|
|
|
|
* création de l'arborescence android
|
|
|
|
|
|
Dans le dosser du projet :
|
|
|
|
|
|
`ionic capacitor add Android`
|
|
|
|
|
|
ou
|
|
|
|
|
|
`ionic capacitor add ios // pour apple`
|
|
|
|
|
|
Erreur rencontrée :
|
|
|
|
|
|
`erreur: > capacitor init proxy-example io.ionic.starter --web-dir www`
|
|
|
|
|
|
`[error] Cannot run init for a project using a non-JSON configuration file.`
|
|
|
|
|
|
` Delete capacitor.config.ts and try again.`
|
|
|
|
|
|
`[ERROR] An error occurred while running subprocess capacitor.`
|
|
|
|
|
|
\-> la suprresion du fichier capacitor.config.ts et la relance de la ligne de commande résout le soucis.
|
|
|
|
|
|
* compilation de l'application
|
|
|
|
|
|
`ionic capacitor build android`
|
|
|
|
|
|
Erreur rencontré, capacitator ne trouve pas le path d'android studio
|
|
|
|
|
|
`> capacitor open android`
|
|
|
|
|
|
`[capacitor] [error] Unable to launch Android Studio. Is it installed?`
|
|
|
|
|
|
`[capacitor] Attempted to open Android Studio at: /usr/local/android-studio/bin/studio.sh`
|
|
|
|
|
|
`[capacitor] You can configure this with the CAPACITOR_ANDROID_STUDIO_PATH environment variable.`
|
|
|
|
|
|
Éditer la variable d'environnement :
|
|
|
|
|
|
`echo export CAPACITOR_ANDROID_STUDIO_PATH="/home/caluome/android-studio-2020.3.1.25-linux/android-studio/bin/studio.sh" >> ~/.bashrc`
|
|
|
|
|
|
`source ~/.bashrc`
|
|
|
|
|
|
ou faire un lien symbolique :
|
|
|
|
|
|
`sudo ln -s /home/caluome/android-studio-2020.3.1.25-linux/android-studio/ .`
|
|
|
|
|
|
Relancer la commande
|
|
|
|
|
|
`ionic capacitor build android`
|
|
|
|
|
|
Android studio va se lancer tout seul et charger l'application
|
|
|
|
|
|
* lancement de l'application sous android studio
|
|
|
|
|
|
Les fois suivantes le lancement de l'application se fait via cette commande depuis le dossier de l'application :
|
|
|
|
|
|
`ionic cap open android` |
|
|
\ No newline at end of file |