gradlew clean vs gradlew clear what is the difference - android

I wrote by mistake gradlew clear instead of gradlew clean in my react-native project's android folder, and I see that it does some serious work. So what is this doing and what is the difference between gradlew's clear vs clean? I could not find documentation.
Also it would be good to understand: When I run gradlew.bat it seems I'm running a java class. Where is the clean and where is the clear java class? Or is this some internal command of the gradlew (java) program?

OK, so the serious work is "loading 6/6 projects" and then after a while of churning away it says:
C:\dev\devreact\noam\android>gradlew clear
Incremental java compilation is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
Task 'clear' not found in root project 'noam'.
Some candidates are: 'clean'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 49.374 secs
So there is no gradlew clear
About the clean: you can glean much information by reading this: https://www.labkey.org/Documentation/wiki-page.view?name=gradleClean
The Gradle docs say nothing about cleaning and do not really explain the internals of Gradle.

Related

How to Run with --stacktrace option to get the stack trace

I keep getting this error and i don't seem to find any help online. I am new to flutter and android studio. any help is well appreciated
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Android\Android Studios\cravings\android\app\build.gradle' line: 26
What went wrong:
A problem occurred evaluating project ':app'.
Could not open dsl remapped class cache for eq9b73nqpstq0kplnrtticwqc (C:\Users\October Price.gradle\caches\5.6.2\scripts-remapped\flutter_f2f86ofj12jp9hosmvp06kahh\eq9b73nqpstq0kplnrtticwqc\dsl9d9bdfa13168004751655a79e56a065e).
Unexpected lock protocol found in lock file. Expected 3, found 0.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1s
Finished with error: Gradle task assembleDebug failed with exit code
You can try running the assembleDebug Gradle task manually.
cd android
./gradlew assembleDebug --stacktrace
But there could be something wrong with your configuration.
Run flutter doctor -v and see if everything is setup correctly.
Otherwise you can try deleting the Gradle cache folder which seem to bet at C:\Users\October Price.gradle\caches.
You can set your android compiler to always run with --stacktrace modifier.
Head to Settings > Build, Execution, Deployment > Compiler
Add --debug or --info or --stacktrace (Or combination of them) to the Command line options
In your case clearing C:\Users\October Price\.gradle\caches folder and re-syncing the project might help.
You can also use --verbose to get the full flutter stack trace. so for example:
flutter build apk --debug --verbose
You can use gradlew command to run from command line. to get more details of gradlew you can type gradlew --help. For further information regarding How to run from Command line follow this link.

Unable to find java.lang package for flutter

I'm beginner for flutter. After coding something I want to simulate codes for Android emulator. I could run successfully a few days ago but today I can't. Error code says unable to find package java.lang. I didn't find where I should look for find problem. SDK path is correct, flutter doctor didn't find any problem. Also I can run project with iOS emulator. I am working on MacOS. Here whole error information.
Fatal Error: Unable to find package java.lang in classpath or bootclasspath
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':location:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
Gradle task assembleDebug failed with exit code 1
You may want to run with verbose enabled, flutter run -v. Then you can find the possible error and warnings. It also happens when your code is incompatible to the gradle version. And the solution for it is to delete .gradle from your use home folder, then on next build flutter will redownload compatible gradle version. In case of Linux, rm -rf ~/.gradle.
Main problem is about packages. Some of them needs android migrate to androidx. When project migrated androidx, problem is solved.
Documentation

Task 'continue' not found in root project 'Demo2'

I built an android project, and when I ran it, there was the following problem. even if I created a new project in any directory, the problem also appeared. so what's going on here?
BUILD FAILED in 0s
Executing tasks: [:app:assembleDebug]
FAILURE: Build failed with an exception.
What went wrong:
Task '–continue' not found in root project 'Demo2'.
Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace > option to get the stack trace. Run with --info or --debug option to get >
more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 0s
This looks strange. The error seems to be the – character, which is not a double-dash -- but rather what happens sometimes when a text editor transforms a double in a long one.
--continue is not a task but a Gradle command line flag used to tell a build to continue executing even after a task fails.
Without more context regarding the creation and exact steps to launch the build, it is impossible to say more as to why this happens in your case.

Gradle: Could not read settings file

I accidental ran
./gradlew heck
instead of "check"
now I get the build error
FAILURE: Build failed with an exception.
* What went wrong:
Could not read settings file '/home/.../ProjectFolder/heck' as it does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
What the heck? I just wanted to check!
I just ran into a similar problem, except I was running this:
gradle -clean build.
And getting an error that it couldn't find the file "lean".
See our problem?
We both accidentally called the "--settings-file" option, which is abbreviated by "-c".
Get rid of the dash, and your world will be good again.
As mine is now.
:-)

How to clear Gradle scripts cache folder automatically?

Welcome all
I'm developing an automatic APK generator which compiles android apps using gradle console commands. I found this problem:
FAILURE: Build failed with an exception.
* What went wrong:
Failed to create parent directory '/root/.gradle/caches/2.2.1/scripts/settings_14c7jxprvkvxiv2ted70j3e0u' when creating directory '/root/.gradle/caches/2.2.1/scripts/settings_14c7jxprvkvxiv2ted70j3e0u/SettingsScript/buildscript'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
java.lang.Exception: Error processing Build command. Error code: 1
The problem is that directory /root/.gradle/caches/2.2.1/scripts/has hundreds of thousans of subdirectories generated and it has reached linux inode limit.
Why is gradle generating all those directories and how can i tell gradle to stop this? Whould be perfect if gradle has an option to delete/clean these cache directories automatically.
IMPORTANT: I'm not using android studio, all the process is automatized and using console commands (gradle assembleRelease)
Thx

Categories

Resources