Gredlew taskname - command not running Android studio terminal - android

I was trying to run a Gradle command on android studio terminal but it shows
like:-
'grdlew' is not recognized as an internal or external command,
operable program or batch file.
the exact command was 'gradlew sonar'
Please guide me how to solve this.

gradlew command is available in your project directory. If you are trying to run this command from somewhere else it will throw an error.
Also, gradlew command package is automatically generated by Android Studio when you create a new project. It will also prompt you to generate new gradle wrapper when you open the project.

After spending a lot of time on it and above solutions also not working for me
I found one thing that is my system doesn't have Gradle installed so I installed Gradle into my system and provide the bin folder path in a system environment. Like
i.e.
PATH
D:\gradle-6.0.1\bin
And then go your project directory and open the cmd window there by typing cmd in the file path view and run gradle query like this
gradle sonarqube
-Dsonar.projectKey=$REPLACE_WITH_GENERATED_keyCreatedOnSonarqube
-Dsonar.host.url=http://localhost:9000
-Dsonar.login=$REPLACE_WITH_GENERATED_TOKEN_OnSonarqube
And this made my day
I hope this will help anyone else also

Related

How do I fix "Error: No pubspec.yaml file found." in flutter w/ Android studio?

I've been looking and googling for a while and couldn't find a fitting answer, I've tried different commands through the terminal, as was suggested in some forums but nothing really helped.
I have this issue for some reason only with a specific project, other flutter projects that I have are running with no issues at all
For Example, I've tried to run this in the terminal and this is what I got:
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project
Any help, suggestions, and recommendations would be much appreciated
This problem is due to the fact that you are running the flutter run command from a different directory. Usually, when you try this command, you are in the parent directory instead of the root directory.
Try running the flutter run command from the project directory using the cd YOUR_ROOT_DIRECTORY command you can enter to that directory.
decided to reinstall android studio and make sure that everything is correct with the PATH of the SDK, and reinstalled the SDK tools.
pretty much worked for some reason

Gradle does not have execution permission

I am having this problem when I try to compile my first app in flutter. I have already read several solution proposals but they are for mac or linux, when I try to use the command: chmod a + rx android / gradlew it tells me it does not exist. I am using windows. I attach photos of the error error flutter doctor
From the screenshot given the problem seems to be with where your project is located. Try moving your project into an accessible folder/ directory outside of the the C:/ or the current directory into something like C:/users/your_username/fluter_development/. This will make sure that gradle has the right permissions to download the necessary artifacts to build your app successfully.

How to create local.properties for android project in jenkins?

We have an android project for an application, it builds without any error on our local machines. Recently had to configure jenkins for the same.
Every time we run the job the BUILD FAILED. Looking for the solution to the error we got to know that the local.properties is missing in the jenkins jobs workspace of our project.
Usually this file is created locally by Android Studio. Is there any way to get this done using gradle commands or code changes?
For our jenkins sdk.dir = "/var/lib/jenkins/tools/android-sdk"
Thanks
A simple hack - Try echoing the path to a file using shell at the same job before using any gradle command as :-
echo "<path to the sdk on jenkins" >> local.properties
You need to install a plugin to create this configuration file. For example, you can use this: https://wiki.jenkins-ci.org/display/JENKINS/Config+File+Provider+Plugin.
But the main problem is that your local.properties file will be in another folder, so your gradlew execution won't be able to find it.
Another solution is to setup your Jenkins System configuration, adding an environment variable ANDROID_HOME and the value is path\to\your\sdk

Building android app with command prompt

i am trying to build my first training application for android using only sdk tools. I am using this tutorial: https://developer.android.com/training/basics/firstapp/running-app.html
I am in my project folder which was generated with android create project command.I am using windows 8.1 64 bits.
Unfortunately when i am trying to run gradlew.bat assembleDebug i an got error:
'gradlew.bat' is not recognized as an internal command or external command,operable program or batch file.
I don't know what is going on. I add platform-tools and tools to my path. I would be grateful for help!
When i am using gradle -v i am getting information about gradle. Byt gradlew.bat is not working.
Find the directory where gradlew.bat present and add it your the Environment path.
I found gradlew in he below path and it works!!!!
C:\Program Files
(x86)\Android\android-sdk\tools\templates\gradle\wrapper\
Just do this, this solved my problem before.
Open Control Panel
Go to System → Environment Variables
In PATH add the following entry at the beginning: %SystemRoot%\system32;

Cannot run program "sh": Launching failed

I downloaded cygwin and install. Then copy the ndk file to android folder. The path is C:\Program Files\Android\android-ndk-r9b then add this path to systemVaraible. Then choosen ndk location in Eclipse preference. Then right click the project, select AndroidToold->Add Native supportI'm getting this error: Build of configuration Default for project ImageTargets
(Cannot run program "sh": Launching failed)
Then open the cygwin terminal type $ cd /cygdrive/c/Program Files/Android/androi-ndk-r9b/samples/san-angles ndk-build
Below error i'm getting. Where i made mistake?
-bash: cd: /cygdrive/c/Program: No such file or directory
I had the same error on Windows and it was resolved by setting the correct path for Android NDK in the Eclipse workpace (Preferences->Android->NDK).
You don't need cygwin to work with NDK r9b on Windows. But whether you have cygwin installed or not, you should avoid spaces in the file names for your Android NDK or SDK installations. The easy fix would be to specify the path using short name, e.g. C:\Progra~1\Android\android-ndk-r9b.
See more at The Android emulator is not starting, showing "invalid command-line parameter", or Using Proguard for Android in Eclipse got Error.
the "Cannot run program "sh": Launching failed" may come from a bad eclipse configuration.
You can try to reset C/C++ Build configuration, inside your project settings:
Also on Windows, like Alex Cohn said, you don't need cygwin and can directly launch "ndk-build.cmd" script that is inside your NDK installation folder.

Categories

Resources