cd android && ./gradlew assembleRelease '.' is not recognized as an internal or external command, operable program or batch file
Solution 1
For Windows you need to use backslash in the original command
cd android && ./gradlew assembleRelease
Solution 2
As a part of solving this issue for Windows, I found that the following steps are required for building React Native from source:
-
Make sure that you have Java jdk, Android SDK and gradle installed and they are accessible as global variables. You can check it by the following command (see more How to set up the environment variable for Windows):
java -version android list target gradle -v
-
it is necessary to set up gradle environment for root/android/ directory of the project (gradlew.bat executive file and other environment files)
gradle init
Note: you need to rename or remove build.gradle file before you run gradle init. After you run gradle init, you can return build.gradle back.
-
Create directories and file AndroidManifest.xml as it is shown below
root\android\src\main\AndroidManifest.xml
-
AndroidManifest.xml has to have the following minimal content:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="myAppName"> <uses-permission android:name="myAppName" /> <uses-feature android:name="feature-01" android:required="false" /> </manifest>
-
For Windows you need to use backslash in the original command
cd android && .\gradlew assembleRelease
-
You are going to find the resulted build package by this path:
root\android\build\outputs\aar\android-release.aar
Roman
[email protected] +1 415 6509893 || +1 6507410014 Technology stack MERN: React, React-native, Redux, Typescript, ES6+, NodeJS, NestJS, ExpressJS, API, MongoDB, Webpack, NodeJS package creation/ building/ publishing TDD: Jest, Enzyme, Sinon, Cypress, TestCafe CD/CI: AWS CDK/ SDK, Jenkins, Bitbucket pipeline ML/AI: Keras, Tensorflow, Matplotlib, NumPy, Pandas, SciPy, PyTorch, FANN LAMP: Ubuntu, Nginx, SQL, Python +MyPy, PHP VC & TM: Git, Github, Bitbucket, Gira Libs/Commons: Lodash, Antd, React.semantic-ui, DOM, HTML5, CSS3, CSS FlexBox
Updated on June 18, 2022Comments
-
Roman almost 2 years
The official ReactJS documentation suggests to run the following command in the terminal for generating the release APK
cd android && ./gradlew assembleRelease
I get an exception in response to this command:
cd android && ./gradlew assembleRelease '.' is not recognized as an internal or external command, operable program or batch file.
What is an issue?
-
OneCricketeer about 6 yearsThe
$
commonly refers to a Unix shell... Your error indicates you're running Windows -
Praveen Danagoudru about 4 yearsThanks, it's working. simple but took a lot of time.