React Native gradle executionHistory.bin too big - android

I've recently upgraded my react-native app to version 0.60.5, as to fulfil App Store requirement of 64-bit app, but I've noticed that the executionHistory.bin file inside android/.gradle/x.x.x/executionHistory got really big, going from ~6Mb, to ~100Mb, which is a real pain as GitHub won't allow files larger than 100Mb to be uploaded. I searched a way to clean the file, delete it and recreate it but really haven't found much. I want to know how to solve this issue, if I screw up upgrading my rn version or something.
Specs:
OS:
macOS Catalina
version: 10.15.1
React-Native: 0.60.5

The .gradle directory should be added to the .gitignore. There is no need to have this in version control as it is just used to store some build cache and various things that get re-generated when gradle builds.
My suggestion... Delete the .gradle directory locally and from your git repo (it will regenerate next time you build android). Then add it to your .gitignore.
See here for the recommended ignore file for react-native (created by react-native):
https://github.com/facebook/react-native/blob/master/template/_gitignore

Just in case you are having this issue AFTER committing and pushing...
I just realized I had this issue when cloning a large repo (~470MB).
I used https://github.com/newren/git-filter-repo to inspect large objects that were bloating the git history, and found executionHistory.bin, node_modules and all kinds of other shit that should never have been checked in the first place.
I made a list of files a directories to delete from history and added them in a file to_delete.txt, in the directory one level above my repo:
# Files and directories to delete
android/.gradle
node_modules
...
And then:
git filter-repo --invert-paths --paths-from-file ../to_delete.txt --force
Note the --force option, because I was getting wrong warnings about my repo not being a fresh clone.
After this, my repo size is just above 6MB, which makes much more sense for the small-ish project that it is 🎉🤩🥳
Hope this helps!

Related

Flutter appbuild contains deleted files but only in one configuration

I recently had to purge a whole bunch of assets from a Flutter Android project because the resulting aab is over 150mb.
This worked for one configuration. For another configuration all the files that were deleted are magically in the build. The files do not physically exist in the repository, or on disk, or in the project.
A colleague of mine ran the exact same flutter appbuild command with the same parameters and got the correct build with the correct assets.
I've done flutter clean thousands of times trying to get the dependencies to work so it's not a case of running flutter clean.
Where is the build getting these files from?

Android studio. Gradle sync error. Project "projectame" refresh fail

Screenshot1
Screenshot2
I have tried multiple solutions including:-
1. Invalidate cache and restart
2. re-installing gradle
3. deleteing .gradle folders
4. uninstalling,re-installing android studio
Also, my project was working very well much yesterday. The sdk's that i downloaded also seem to be missing now(I made sure not to delete the sdk folder after uninstalling). The only thing i did was system recovery on my dell-pc ( do not delete files mode)
Maybe you are using git or any other vcs? If yes, you could clone working project and eliminate project files are corrupted.
At screen I can see that you haven't recent version of AS - try to download latest version from link

Cloning down existing Android Studio project

I have been working on a local machine and pushing my changes up to Stash (Pretty much BitBucket).
Everything has been going fine but not I am trying to clone the code down to a co-workers machine and am having some serious issues with Android Studio.
I am importing the project through vcs, choosing git option, and providing the URL.
Whenever we try to get the project running we run into build problems and Gradle not working properly. The project is not initially shown as an Android project and we have to configure the framework. Then we have gradle saying it cannot find 'com.android.application' file. I have ensured that I have the correct Gradle version to work.
I think that I may not be pushing up the correct files to Stash, so when we clone the project it does not have enough information to build properly.
The files that I have not pushed up are the following:
build.gradle (at highest level not app level)
gradle.properties
gradlew
gradlew.bat
NAMEOFAPP.iml
.idea/.name
.idea/encodings.xml
.idea/gradle.xml
.idea/misc.xml
.idea/modules.xml
.idea/vcs.xml
.idea/copyright/profiles_settings.xml
.idea/dictionaries/USERNAME.xml
.idea/scope/scope_settings.xml
app/app.iml
gradle/wrapper/gradle-wrapper.jar
gradle/wrapper/gradle-wrapper.properties
You definitely want to push up build.gradle. That is the file that describes the Gradle build for the project.
You will also want the .iml files pushed up, and the gradlew files (which are gradle scripts for different platforms), and probably the gradle/wrapper files.
You do not have to push up the .idea files. They specify the AS/IntelliJ workspace settings. It can be convenient to share these between collaborators as you will all be in the same environment, but it can also be frustrating having other people overwrite your preferred settings, so this is up to the developers in question.

Why can't I see any android source files in working Directory?

I'm downloading Android source code using the following command.
repo init -u https://android.googlesource.com/platform/manifest -b Android-4.1.2_r1
repo sync
I've almost downloaded about 1.4 GB of files, but there is no source code in working directory. Working Directory has only one folder ".repo" (Which is about 1.4 GB and does not seem to include source code).
Is this correct way to download android source code? If not, where am I going wrong?
Finally Got answer.This is working as it should!
First it fills up .repo folder, which can be huge(10 GB). Only after that repo script downloads android source code.
References:
1. After Repo sync, there are no files in the directory
2. What are the purpose of the bare git repositories in .repo/projects/ created by the Android repo script?
If you want to work with android you will want to install the Android SDK. This page explains how:
http://developer.android.com/sdk/installing/index.html
From the SDK Manager, found in the tools directory, you can download any version of Androids source code you would like.
The Android source code actually has an empty master branch.
Unless you specify a particular branch to repo, it will always pull the master branch.
The reason that Android has an empty master branch for many of its repositories is because, the user is expected to use a particular version of the Android source rather than the latest.
(The latest is also typically a branch..but not master)
try something like this
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
You should see files other than just the .repo folder

Android Logcat files on Hudson/Jenkins

we are using Hudson for CI of an Android project with Android emulator plugin to run UI tests on the emulator. A git project delivers the source code.
Now I see that in the git repo, for each build a logcat file is created and put in the git project folder, which is then pushed back to git. As we are expecting a lot of builds, this could easily spam the project folder. Does anyone know if it is possible to set the destination folder for the emulator logs?
I cannot find any options in the emulator plugin or Hudson anywhere.
The logcat files are named logcat_[some_number].log.
Best regards,
Kim
Upgrade to version 2.0 of the plugin (or newer) and you'll see these logcat files are now written to a temporary directory, rather than your workspace.
If you're using Hudson, possibly you only see the very old version 1.6 in the Update Centre.
Which is just another reason to upgrade to Jenkins! :)
However, if you can't upgrade either the plugin or Jenkins (for some weird reason), just use an "Execute shell" step to delete any logcat_*.log files at the start of each build.
These files are purely temporary anyway and should probably only exist in your workspace after a failed build — otherwise the logcat output is archived automatically as logcat.txt.
Add an ant task to rename the logcat file to your convenience and remove the oldest ones.
add the logs to the .gitignore file, if you want to exclude them from your repository.

Categories

Resources