How to clean a module in AOSP? - android

This is the same question as previously another one which I found the solution in is invalid.
Because the command mm -B is invalid.
So how could I clean one specific module in AOSP with clean the other part?

how to make clean module in android
$ make clean-<moudlename>
eg: make clean-libxyz (to clean libxyz.so)
https://dolinux.blogspot.com/2012/05/how-to-make-clean-module-in-android.html
or
NINJA_ARGS="-t clean" mm

You cannot do that , we can build a simple module with this command:
mmm “path to build”
but we cannot clean a module with this command. to perform cleaning source , you should use this command:
make clean

Related

How to sync gradle in React Native (android)?

I tried ./gradlew build but that didn't work, because it doessnt see the changes made in gradle file. The only thing that works for me is restarting and invalidating cache, but there must be a better way to do it.
Thank you
You should try running ./gradlew clean before building.
change directory to /{your project}/android then run below commands
./gradlew clean
./gradlew build
Note :-
you will get error : ./gradlew: No such file or directory
if you are trying gradlew commands outside android folder.
also check this : Why run 'gradle clean build' instead of 'gradle build'?

Jenkins- How to invoke gradle script tasks in different directory than the project root

Project Structure.
Root/
-------Android Project/
----------------------------ProjectRoot
-------Other Folders
My git repo contains Root. Inside root i have my android project.
Now when integrating Jenkins freestyle pipeline,
for wrapper location i simply pass ${workspace}/Android Project where my wrapper actually lies.
But the problem is when i add my tasks: i.e clean | build | assembleDebug its actually running on the Root folder and not inside "Android Project".
i tried "cd Android Project" before running the script but it does not seems to work
i have resolved the issue by simply removing invoke gradle script and adding a shell command window.
Within shell command i cd navigated to the directory i wanted to run the gradle task.
cd to the root directory, then call:
./gradlw :moduleName:gradleTaskName
replace moduleName and gradleTaskName with your project's real names.

How do I run standalone lint from Android SDK Tools on a Gradle Project

When I try to run the lint tool provided in the Android SDK Command Line tools, it fails with the following error
build.gradle: Error: "." is a Gradle project. To correctly analyze Gradle projects, you should run "gradlew lint" instead. [LintError]
1 errors, 0 warnings
My use case requires me to run the standalone lint in a CI environment with specific checks. How do I get around this error?
I searched around for documentation and answers. Documentation doesn't have much information on the topic. I had found one answer before posting this question but the provided suggestions around the error didn't work either. In the end, as Chester said, it didn't even matter.
Since I am running the tool in a CI environment, I ended up doing the following
# delete the build.gradle files from the project
find . -type f -name "build.gradle" -exec rm -f {} \;
# run the lint with whatever checks. It works!!
lint --check Whatever .
# stash everything except the deleted files
git add **/*/build.gradle
git stash -k
# stash the deleted files
git stash
# drop the stash with deleted files
git stash drop
# pop the stash with everything else
git stash pop
It's a dirty hack. Always open to better solutions!

How to Sync Project with Gradle Files?

change gradle.properties by a script ;
manual Sync Project so the resVal and BuildConfig will refresh.
so, what does the manual Sync Project button do?
how to manual write it in my cmd script
May bellow tow thing will do your work
If you want to sync just project without rebuild then use bellow command
./gradlew --recompile-scripts
And if you want to rebuild your full project
./gradlew build
And Also if you want to see your all task then use bellow commands
./gradlew tasks

How to do an android mm clean?

I'm building custom module in Android source using the mm command.
When I run mm clean, it seems that the whole project is cleaned.
How can I restrict the clean to just the current module?
Use mm -B, it will rebuild all, equivalent to clean and then make.
Another way to do without mm is to give make clean-<target name> from root of Android source.
Similarly you can build the required module alone with make <target name>
On older make-based AOSP build system, use
mm -B
to rebuild the module.
On newer Ninja+Soong based AOSP build systems, it seems that -B no longer works. It gives the error Unknown option: -B.
One possible alternative is to use the NINJA_ARGS environment variable to pass additional Ninja arguments to underlying build engine.
For example, the following command removes all output and intermediate files:
NINJA_ARGS="-t clean" mm
In this case clean is an extra tool to the Ninja build system. See https://ninja-build.org/manual.html#_extra_tools for other tools.
One thing to notice is that the clean tool seems to clear all the dependencies of the module, instead of the module itself. I haven't found a way to assign a rule to limit the clean scope to the module only.
references: https://android.googlesource.com/platform/build/soong/+/HEAD/docs/best_practices.md
make <lib> 2>&1 | grep -e "install"
This will make the and print all the libs that were re-compiled.
Prefixing "clean-" to the module name will do the clean build in Android
For ex,
m clean-libskia

Categories

Resources