1, Android Studio Terminal command line invalid problem
The command line terminal terminal is brought in from Android studio, but we often find that "XXX" is not an internal or external command, or a running program or batch file, when we enter a command. Such as:
This is generally the case that the system environment variables are not configured with the corresponding tool path, then we have to the various commands to the system's environment variables to add the corresponding tool command. This article mainly explains the ADB, gradle and Git configuration methods, the other tools are similar in principle, just follow these several ways to add it yourself.
2, Android Studio Terminal adb Command Invalid solution
To first use the command line terminal terminal in Android Studio, configure the ADB path in the environment variable in the system properties:
For example, the following path is the path to the ADB of the SDK in My computer:
D:\SDK\platform-tools
Then open "Computer"-"right"-"properties"-"Change Settings"-"Advanced"-"Environment variables" and add this path to the environment variables in the system properties, such as:
Then go to Android Studio terminal input adb shell
This is the success.
My development environment is Win7, if you are using WIN10 you need to set the Cmd property under the system:
Then restart your Android Studio and you'll be happy to use the terminal.
3. Android Studio terminal or system cmd using gradle command line package apk
At this point if you want to use the Gradle command line in Android Studio terminal or system cmd to package the APK or execute the gradle command will find that you are still prompted: "XXX" is not an internal or external command, nor can run programs or batch files. To execute the gradle command we also need to configure the Gradle path in the system properties in the environment variable. My Gradle path is:
D:\gradle\gradle-2.14.1
Then open "Computer"-"right"-"properties"-"Change Settings"-"Advanced"-"Environment variables", in the system variable, click New, the property name is: "Gradle_home", the property value is: "D:\gradle\gradle-2.14.1".
Then open "Computer"-"right"-"properties"-"Change Settings"-"Advanced"-"Environment variables", in the system variable, locate path, add ";D: \gradle\gradle-2.14.1\bin" to Path:
Finally in Android Studio terminal or system cmd, enter Gradle, if present, the Gradle configuration is successful:
4, Android Studio Terminal git command Invalid workaround
Ditto, if you want to execute GIT commands in Android Studio terminal or system cmd, you are still prompted: "XXX" is not an internal or external command, nor can you run a program or batch file. To execute a git command we also need to configure git in the environment variables in the system properties
Path. My Git path is:
D:\Program Files\git\bin
Then open "Computer"-"right"-"properties"-"Change Settings"-"Advanced"-"Environment variables", in the system variable, locate path, add ";D: \gradle\gradle-2.14.1\bin" to Path:
Finally, in Android Studio terminal or system cmd, enter Git--version, if present, the GIT configuration is successful:
Android Studio Terminal is not an internal or external command, or a program or batch file that can be run