how to run moodle mobile app on android studio - android

How to run moodle mobile app on android studio? I want to add my own plugins as well.
I have followed moodle documentation https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2 but it stuck on Native build dependencies.
Code I am following: https://github.com/moodlehq/moodleapp
Also try to run this code on android studio ( follow:https://www.youtube.com/watch?v=IA3c2lpoOtU&t=757s ),I am having a blank white screen(I have paste moodle src folder on www folder and run the src/index.html)
Can somebody share video tutorial regarding this? It will be really helpful.

At first you need to add android platform to your project by these bash commands:
Removing and adding
npx ionic cordova platform remove android
npx ionic cordova platform remove ios
npx ionic cordova platform add android
npx ionic cordova platform add ios
Once you have added platforms, you can run setup using this command:
npm run setup
After successful setup you can open the the project in android studio:
android studio project location should be CORDOVA_PROJECT_DIRECTORY/platforms/android
Source:
https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2

Related

I am gettin an error when try to generate android or ios build of ionic project

I have project build in ionic
I run the following command
ionic cordova platform remove ios
ionic cordova platform remove android
ionic cordova platform add ios
ionic cordova platform add android
when I run them on my project folder I got the error in the following screenshot
I have tried to delete node_modules folder and run npm install command again but this does not solve my problem
add platform ios need xcode
so
add platform android you need Android Studio

No folders android and ios

Why after create-react-native-app I don't have a folder android and ios?
Now I can't open this by react-native run-android and can't put for example android permissions.
What is wrong?
There are two ways to create React native project.
create-react-native-app AwesomeProject => This used expo to create app and when you use this command to create app you will not find android and ios folder you cant add platform specific libraries.
react-native-init => this app is not created using expo you can find android and ios folder and can do native coding or use platform specific libraries as well as permission you mention.
In your case want to add permissions:
If you wish to do native coding (android and ios) or want to install Platform specific libraries i.e. npm link you need to run npm run eject command
(Note: Once you run eject command you can't run your app using expo. So before doing this go through docs)
you should run react-native init projectName.pay attention you should run cmd as run as administrator
Naviagte to project path and execute the following command to get android and ios folder
1. > npm i //To get all dependencies loaded
2. > react-native upgrade //To get android and ios folder
3. > react-native link //To link the dependencies to ios and android
4. > react-native run-android or react-native run-ios

to what was "ionic platform add android" command renamed to?

I am starting to learn Ionic, and on building my first application, when typing the
# ionic platform add android
it says that the command has been renamed. My question is, what was it changed with?
In the tutorial I follow, it says to execute the commands
# ionic platform add android
# ionic build android
# ionic run android
On searching the web, I have come across the command
# ionic cordova run android
and it also said that cordova was moved to a CLI which also has to be installed.
But what about "add" and "build"? They are not required anymore?
Thank you.
I believe you are using latest Ionic version, 3.6.0 and above. Since then Ionic cli commands have renamed from
ionic platform add android to ionic cordova platform add android
For all the commands append cordova after ionic keyword.
For list of command, refer to the documentation here at https://ionicframework.com/docs/cli/
Your tutorial commands are outdated. But you can still follow them, but just append cordova after ionic keyword
ionic platform add android becomes ionic cordova platform add android
ionic build android becomes ionic cordova build android
ionic run android becomes ionic cordova run android
"But what about "add" and "build"? They are not required anymore?" - You still need them for adding platforms/plugins.
add is used for adding platforms/plugins. For ex: To add ios platform you use ionic cordova platform add ios
build is used for Build (prepare + compile) an Ionic project for a given platform. For ex: To build ios you need ionic cordova build ios
Note: you can replace ios with android or vise versa in any of the above commands.
Since you started learning check this website out, might be a good place to start - https://ionicacademy.com/
Now "ionic" is renamed with "ionic cordova".
So use:
ionic cordova platform add android
ionic cordova run android
***for run on windows****
ionic cordova platform add browser
ionic serve

How do I run an ionic app in android studio emulator?

I am new to ionic and I want to run my app on android studio emulator. I did refer the link
https://developer.android.com/studio/run/index.html. But I do not seem to understand how to run my ionic app on emulator
First ensure that your Android Studio setup is correctly done. If want to do that from scratch refer these links - link1 and link2. In link2, you can choose your OS as well.
This ionic guide will help you setup ionic project correctly. If you follow this guide entirely, you will see the use of emulate, platform, run, serve, etc commands of ionic.
Basically what you need to do is first add an android platform to your project:
ionic cordova platform add android
And then emulate your project using:
ionic cordova emulate android
First open Android studio and start an emulator wait when its still done (first time needs more time)
test if the emulator is available with `android list devices``
ionic cordova emulate android will publish it on your emulator
You can install capacitor which created by the ionic team and i recommend it over cordova
Inside your project do this
ionic integrations enable capacitor
then
npx cap init [appName] [appId]
after that add android or ios folder to your project by this command
npx cap add ios
npx cap add android
then finaly you can run your app by
npx cap open ios
npx cap open android
or this command
ionic capacitor run android
In the latest Android Studio you need to make at least one project and open the project, and then create AVD (android virtual device) in Tools - Android - AVD Manager, and then in your ionic project
ionic cordova emulate [platform]
I was able to run the ionic app in emulator by first launching it from the Android Studio on Windows. Trying to run just by the command timed out.
-Start emulator from Studio (Tools | AVD Manager)
-On command line, run "ionic cordova emulate android"
step 1 - Create Virtual Device
AVDs are managed with the AVD Manager. In the Android Studio welcome
screen, click Configure » AVD Manager. The AVD Manager can also be
opened inside Android projects in the Tools » AVD Manager menu.
step 2 - set environment From the desktop, right click the Computer icon.->Properties -> Advanced system settings->Environment Variables->User variable ->Path->edit->New and add your emulator path like given below
eg. C:\Users\kunal\AppData\Local\Android\sdk\emulator
then,
ionic cordova platform add android
ionic cordova emulate android
or
ionic cordova run android
You can use this for example :
ionic cordova emulate android -lcs
If you have not integrated capacitor to your project follow from step 1. If you have already integrated capacitor follow from step 2.
Enter below command on your command prompt.
Step 1
ionic integrations enable capacitor
Step 2
npx cap init [appName] [appId]
(appName is the name of your app, and appId is the domain identifier of your app (ex: com.example.app))
Step 3
ionic build - Build your application
Step 4
npx cap add ios - Copy to ios destination folder
npx cap add android - Copy to android destination folder
Step 5
npx cap open ios
npx cap open android
If you need to run ios app on a emulator you need to have xcode in a mac device. But if you need to run it on an android emulator you need to install android studio either on ios or windows.

Deploy working polymer app to android using cordova

Yes,We have resources for this on net and I searched for that ,But it didn't solve my problem so asking this question here.
I have a working polymer web app and I am able to access this using http://localhost:8080//index.html,My app looks like this
I want to deploy this app in android phone,So I used apache cordova
Below are the steps I followed
Installed cordova using
npm install -g cordova.
create cordova project
cordova create alertsDir com.alerts.net "Alerts" --template=C:/Users/212606402/Learning/Alert client/alert-push-notification-client
cd to alertsDir and add platform
cordova platform add android
build platform
cordova build android
run project
cordova run android
I am not getting any error in above steps
I run this in both android emulator and nexus 5 devise but it showing the same default cordova screen,My app is not shown there,Below is the emulator screen I am seeing
I followed some tutorials and just wondering how it works for them.
tuetorial 1
Can anyone please explain me what I am missing or doing wrong.Thanks in advance.
as far as i know, Cordova only deploy 2 folder platforms folder and www folder but not all in platforms folder will get deployed to your device, usually the cli will merge platform_www and www folder.
so if you want to make a cordova app you need to put all your sourcecode or sourcecode that already bundeled using either polymer-build with gulp or polymer-cli inside www directory.

Categories

Resources