No folders android and ios - android

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

Related

how to run moodle mobile app on android studio

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

How to create signed apk from Create React Native App not React Native?

I used following steps for creating create react native app
Step 1: install globally react native using this command in cmd: "npm i -g create-react-native-app".
Step 2: Create project using this command : "create-react-native-app my-project".
Step 3: for run go to project directory using this command: "cd my-project".
Step 4: using this command we can run application "npm start".
for more details use this link:
https://facebook.github.io/react-native/docs/getting-started
*Note:
React Native and Create React Native has different architecture.
In Create React Native there is no Android and ios folder*
I have created apk from expo but this is not signed apk.
I don't know exactly how it works with CRNA but since it's based on Expo, according to this page:
after the set up you have to run exp build:android or exp build:ios
You can run npm run eject in console - beware that it is permanent action, but your ios and android folders will appear. Then, there you will find project files, that you can open with XCode/Android Studio and create signed builds from there. Otherwise you can check here Deployment and Sharing app. As you can see : "If you want to build and deploy your app yourself, you'll need to eject from CRNA and use Xcode and Android Studio."

React Native - Open Old Version Project (up to 0.48v)

I learning React-Native with Windows 10, Using Git Bash Command Prompt and Android Studio Emulator.
I have Install React Native globally by using npm install -g react-native-cli, I always create Project using react-native init ProjectName and
My Project Launching Method is
go into Project Directory with Git Bash CMD and execute react-native run-android.
I notice that most of the Project in Github are older version which consist of index.android.js and index.ios.js (My Project is newer version so it only have index.js). I been trying to open some older version Project, but it seem like it just does not launch with the method I mentioned above.
I also have tried react-native start method from How to open existing project in React Native? but I still not able to launch it.
The error message when I trying to launch the project is Command unrecognized. Make sure that you have run npm install and that you are inside a react-native project. This Problem only occur when I trying to launch project from Github, when I open my own Project there is no such problem.
ps. If I try use npm install in the project directory, it will have some error.
I have try to search from Net, most of their launching method are the same as above and does not work for me, so wanna ask that:
Is my method of launching React-Native is wrong in the very beginning?
Is there anything I need to install so that I can open old version React Native Project?
How can I open this project with my current situation? https://github.com/parkerdan/SampleNavigation
Thank you.
Extra Info (React Native CLI and Node Version):
$ react-native -v
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
> process.version
'v8.9.4' (Node Version)
After whole day of Searching, I have found the Solution.
Whenever open any Project from Github or any sources, we have to ensure that the we have install all the required Dependencies, as Most of the Project using different type of dependencies that you may have not ever install.
Solution:
Download project
git clone https://github.com/parkerdan/SampleNavigation.git
2. Go to the Project Directory and Install dependencies (IMPORTANT)
Note: For unknown reason, npm install does not work
npm i
or yarn i
Run Project (or any launch method that work you)
react-native run-android
After you clone your project from git and cd to project folder, make sure you run npm install before you can react-native run-android.

React Native iOS and Android folders not present

I'm new to react native, and I've been having some trouble understanding the folder structure of the app which should supposedly be present in the project folder on creation. Basically, when creating the project with npm, I get some starting files (App.js etc.) and a node_modules folder. I've got it up and running with expo, which created the .expo folder as well.
However, when I go to react's official documentation or look into plugins/addons on git they talk several times about an android and an iOS folder in the project root. But they are nowhere to be seen. I then got some hints that I could install and run react-native-upgrade-git, which allegedly would generate these missing folders. But that didn't work either.
So what have I missed? Where are those folders located?
Edit: Here is a screen dump from a Youtube tutorial showing the project structure I'm looking for:
One of the points of Expo on top of React Native is that you don't go down to android or ios code. Expo deals with those folders for you, you don't need to interact with them. Is there a reason you need those folders? if so, you will have to eject. Here's the documentation to do so: Ejecting with ExpoKit
You can get to that project structure by running:
npm run eject
However, it removes the app from the Expo framework, which adds a lot of nice benefits and abstraction from the Android/iOS code.
i think if you want to develop app with ReactNative you start follow this : Getting Started use React Native.
If you create project with ReactNative just write on your terminal like:
react-native init YourProjectName
cd YourProjectName
react-native run-ios //for iOS
I hope my answer helping you to create project with ReactNative. thanks..
Check this Expo document Adding custom native code
In general,
to generate ios folder: expo run:ios
to generate android folder: expo run:android
Try this to generate the Android and iOS folder
react-native eject
react-native link
To add to Funk Soul Ninja's answer after following his directions (thank you! :) ), for those who started with an Expo project:
expo run:ios
did the trick for me.
The command creates the ios folder that contains the project that can be edited and built in Xcode.
I did not do this step, but I believe expo run:android does exactly the analogous thing for Android; but I would suggest checking out Expo documentation on adding custom native code.
I think I am little late but follow this steps if you don't want to read any document.
android and ios folder are not present when react native project is created with expo. so you have to detach expo from your project to create android and ios folder.
first add required package name in app.json file
ios: {
bundleIdentifier: "com.yourcompany.yourappname",
},
android: {
package: "com.yourcompany.yourappname",
}
then run below command in terminal
exp detach
after command is successfully executed you will find android and ios folder
Delete folders android and ios
npm i react-native-eject
react-native eject
I had to run expo eject. The story behind why I didn't have the folders is had to downgrade my react-native application because of some broken dependencies and then I got build failures. So I deleted the ios and android folders then ran expo eject and got all the build issues fixed. Note that I used expo command line via a script in package json so that the versions would match the version my project was using.
run this in the root directory
expo eject
in the begining install react native, after run expo init YourProject , choose minimal (Typescript) . after that go to YourProject directory and do not run npm start. but run npm run android. hope this help
This worked for me: Go to Setting and remove both entries "android" and "ios" from "Files:Exclude". Don't forget both environments - User and Workspace.
Removing entries on Workspace:
... same for User:
If you created the project with Expo you will have the Expo folder instead of ios and android folders
If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues:
npm uninstall -g react-native-cli #react-native-community/cli
then create a new project again:
npx react-native init DemoApp
The simplest way I know
1) Take your app name from your current app.json, let's say the name is "mynativeapp"
2) make a new folder somewhere outside of your current project folder
3) start in it:
react-native init mynativeapp
4) the command above will make android and ios folders internally compatible by name with your project
5) copy android/ios folders into your project folder
Now you can try to start your native project. I checked that for Android:
react-native run-android
enjoy!
P.S. "react": "16.9.0", "react-native": "0.61.4"

How to run/install the React Native official examples?

For example, I'm trying to run the UIExplorer example.
I cloned the https://github.com/facebook/react-native/tree/master/ repository.
Did react-native init ExplorerApp
Copied everything inside the UIExplorerfolder and pasted it inside the ExplorerApp folder (except the android folder)
However, when I run ExplorerApp I still get "Welcome to React Native"!
Maybe I have to modify index.android.js so it somehow points to the pasted files? How to do that?
To run the official RN examples, follow these steps
git clone https://github.com/facebook/react-native.git
cd react-native && npm install
iOS
Now open any example (the .xcodeproj file in each of the Examples subdirectories) and hit Run in Xcode.
Android
You need to install Android NDK : see prerequisites here
To start the Movies Example :
./gradlew :Examples:Movies:android:app:installDebug
Start the packager in a separate shell (make sure you ran npm install):
./packager/packager.sh
Open the Movies app in your emulator

Categories

Resources