Skip to main content

Posts

Insufficient Memory on Android CI Server

Insufficient Memory on Android CI Server We recently faced an error where jenkins in our Android CI setup was aborting builds because of insufficient space on the box. This was strange since we have allocated a huge 250G box solely for this purpose. While trying to solve this issue, I came across some useful things that I think might be useful for other people and whoever is facing this issue, it’d be worthwhile to check these points: If you have been using gradle’s build cache, check it’s folder’s size ( .gradle folder in your home). In my case, it was taking 123GB !. This is because it never used to clear the cache. Keep in mind that clearing all of it will slow down your builds. So you’ll have to clean it smartly. One option is going with time based approach. This tip ( shared by Gautam Korlam ) cleans up files not accessed within the last month: find ~/.gradle -type f -atime +30 -delete find ~/.gradle -type d -mindepth 1 -empty -delete In my case, I
Recent posts

DialogFragment : NullPointerException (support library)

Another weird crash this time ! Here’s the stack trace : Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{<activity.fully.qualified.path>}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Dialog.setContentView(android.view.View)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2659) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724) at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4524) at android.app.ActivityThread.-wrap19(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1479) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6123) at java.lang.reflect.Method.invoke(Method.java) at com.android

Android java.util.zip.ZipException: duplicate entry

Android java.util.zip.ZipException: duplicate entry Recently, I faced this build error while trying to integrate kotlin in our project. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:transformClassesWithJarMergingForPreKitkatDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/intellij/lang/annotations/Identifier.class As you can see, gradle is trying to add same entry two times, referenced by different dependencies. So to figure out which are those two dependencies, I built the project with some extra options : ./gradlew assembleDebug --stacktrace --info | grep Identifier.class This was the output: addJar(/Users/yashasvi/.gradle/caches/modules-2/files-2.1/com.intellij/annotations/12.0/bbcf6448f6d40abe506e2c83b70a3e8bfd2b4539/annotations-12.0.jar): entry org/intellij/lang/annotations/Identifier.class addJar(/Users/yashasvi/.gradle/caches/modules-2/files-2.1/org.jetbra