Steps to Build Offline APK for Real Device – React Native

To test our React Native App in our phone, we can follow the following steps.

STEP 1 : Generate JS Bundle

Run the above command in your project root folder. This will pack your code into a static file.

STEP 2: Build the APK

navigate to android folder using this command in terminal.

Now build a debug APK using gradle

Now you can find the APK file in the following path

Now we can install this APK in our Android phone to test our App.

TypeError: cli.init is not a function – React Native

This error will come while running the following command.

This happens because react-native-cli is deprecated and not compatible with recent versions of node js. Especially from Node 18 + it throws this error.

To fix this issue first Uninstall react-native-cli using the following command.

use the official CLI as follows

Now it will install all the required packages to run the App.

How to avoid prefixing every table with schema name while creating new tables ?

Lets assume schema name is my_data. If we want to avoid prefixing every table with my_data while creating a new table, we can set it in the search_path.

Now we can create a new table like this.

By using the above code, courses table will be created in my_data by default.

What command we need to use to list all tables inside the specific schema ?

Suppose if the schema name is my_data, then we need to use the following command to list all the tables inside the my_data schema.

Now, if you want to create a new table inside the my_data schema, we just need to prefix the table name with the schema name like this.

This will create the students table inside the my_data schema.

What command we need to use to list all schemas in the current PostgreSQL Database ?

This command is used to list All Schemas in the current PostgreSQL Database along with their owners.

The \dn command is a PostgreSQL-specific meta-command used inside the psql command-line interface.

The default schema is usually public. Generally we use /dn to check existing schemas.