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.
Related
So while installing flutter and Android Studio. I did encounter several problems. First is the "Exception: Gradle task assembleDebug failed with exit code -1" when i run the program. this thing always appears in my runs no matter which folder/emulator I do. So I tried to go and check several videos. including uploaded by BD Technic(youtube) how to fix this kinds of problem. I also went to SDK Manager and check if the SDK Command-line tools are check. I check and the problem is still there. i tried to recheck and the problem is still there. Then I uncheck the Hide Obselete Package and see if the Android SDK tools(obselete) was check(according to BD Technic) and the problem IS still there.
So I decided to go use the Flutter Doctor --android-licenses and shows that the problem(screenshot) is this.
I went to the folder and see if maybe it was bugged/corrupted then I realized...I don't have the SDKmanager folder...
normally when you run this android-license it should run differently and show "Accept [y/n]" base on youtube videos I watched.
So my question is 2: How to fix "Exception:Gradle Task..."?knowing my license isn't working. I tried several guide and it has a similar problem. I'm not sure if having missing SDK Manager is the solution or maybe after you install the license it should be created instead. I have literally different problem compare to other people posting AndroidStudio errors when it comes to exception:gradle task
do I just need to reinstall the entire android studio? as well as the flutter.
you should check the following things:
Java JDK setup and add it (JAVA_HOME) to environment variables ( Windows operating system).
Install a Gradle and add it to the environment variables (GRADLE_HOME).
Install the SDK Android and to add it to the environment variables (ANDROID_HOME).
Then The command is executed in Flutter cmd
flutter doctor --android-licenses
I hope I helped you
source !
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
Currently, I am getting "Finished with error: Gradle task assembleDebug failed with exit code 1" while trying to build a Flutter project (flutter run). The logs do not help much. Therefore, i want to run "gradlew build" or similar manually with stacktrace option to see what is happening under the hood. What is the command for that ?
For posterity I will post my comment as an answer too and I'll elaborate it a bit.
When you create a flutter project there are two new folders created inside the main folder, one is android and one is ios.
The android folder contains the Android native code and all the android configurations, you can handle it as a native android project.
The ios folder contains the iOS native code and all the ios configurations, it also has the xcworkspace file which can be opened with Xcode like a normal ios project.
Now you can run platform specific commands in each folder, like i said, the folders contain actual native projects.
So for Android you could do:
cd android/
./gradlew clean
./gradlew build
(clean and build the project)
For iOS you could do:
cd ios/
pod repo update
pod install
(update the pod repo and install the pods)
Just a short reminder, if you want to create apk/ipa from the native folders, don't forget to run flutter build in the main folder, otherwise you might get outdated code in your apk/ipa.
Go to the folder where you have gradle installed(the place where your GRADLE_HOME variable points to).
Move inside the wrapper folder
Move inside the dists folder which is inside the wrapper folder
Delete everything that you can find inside the dists folder(cached gradle wrapper)
Run/launch your android flutter project again. It should re-download the gradle wrapper and if you don't have any connection problems your project should run correctly.
Note: I'm having the same problem because of my unstable internet connection. I'm ending up with a corrupted gradle wrapper file and the download doesn't restart.
If the download gets interrupted and fails to completely download and launch your project repeat all of the steps.
App originally created in Win 10. I switched to Ubuntu.
When I try to run an app I get the following error.
Any ideas where do I need to edit the path (prev. C:\)?
Thanks, Ron
* What went wrong:
Could not determine the dependencies of task ':app:flutterBuildDebug'.
> java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\\Dev\\FlutterApps\\xxxxxxxxx\\lib\\main.dart
Actually, flutter saves the path of your packages in a file. So, the error you are getting is because the path from Windows file system are saved in your project and those path are not valid on Ubuntu. To solve this:
open terminal in your project directory and use flutter clean.
then flutter packages get
now try to run your app.
Nevermind. I just ran flutter clean which removed the build folder. Then ran flutter run and it rebuilt the build folder and loads now.
I'm configuring my build pipeline for an Android project. So far, all of my steps are working perfectly on Hosted VS2017 agent, including fetching the code, building with gradlew, publishing the artifact and deploying it to AppCenter.
However, on Hosted Ubuntu 1604, there are a few problems with gradlew step.
On VS2017 agent, this works with just: .\gradlew assembleDebug
On Ubuntu 1604, this is what I'm having right now:
chmod 775 gradlew
chmod 775 /usr/local/lib/android/sdk --> The fix I'm working on
./gradlew assembleDebug
Running the build without the 2nd line, agent will throw this exception:
What went wrong: A problem occurred configuring project ':app'.
Failed to install the following SDK components: build-tools;28.0.3 Android SDK Build-Tools 28.0.3
The SDK directory is not writable (/usr/local/lib/android/sdk)
I'm a beginner with Ubuntu... why is it not writable? I tried to chmod but I got the exception while doing so: chmod: changing permissions of '/usr/local/lib/android/sdk': Operation not permitted.
Which direction should I look at to solve this problem now... ? Thank you all in advance!
Change the ownership of Android SDK:
sudo chown -R $(whoami) $ANDROID_HOME
I had the same problem on a standard Ubuntu install.
The solution: install the Android SDK in your home directory.
The problem is, building a project with Gradle fails to work with a read-only SDK. Installing the Android SDK with apt leaves it read-only.
More precisely, everything in /usr/ is supposed to be read-only data, so it's owned by root with permissions set to 755. Your user doesn't have write access to it, only the owner does. Installing the SDK in your home directory (and making sure your user owns it) should solve the issue.
Installing the SDK
I haven't seen a good way to install just the SDK. There's another SO question addressing this; one of the ways listed there ought to work.
However, you may find it easier to just install Android Studio, and pick a custom location for the SDK.
Hope it helps!
there is no need to reinstall something at all...
giving the write privilege to the currently logged in user solves the problem.