# AndroidUtilCode — Comprehensive Android Utility Collection > A large collection of commonly used Android utility classes covering activity management, file operations, network checks, permissions, encryption, and UI helpers. ## Install Save in your project root: # AndroidUtilCode — Comprehensive Android Utility Collection ## Quick Use ```gradle implementation 'com.blankj:utilcodex:1.31.1' ``` ```java // Initialize in your Application class Utils.init(this); // Example: check network connectivity boolean connected = NetworkUtils.isConnected(); // Example: show a toast ToastUtils.showShort("Hello"); ``` ## Introduction AndroidUtilCode is a comprehensive utility library that bundles dozens of helper classes frequently needed in Android development. Rather than writing boilerplate for file I/O, permission checks, device info, or encryption from scratch, developers can rely on its well-tested, API-stable utility methods across projects. ## What AndroidUtilCode Does - Provides utility classes for activities, fragments, services, and broadcast receivers lifecycle management - Offers file, asset, and shared-preferences read/write helpers with minimal boilerplate - Includes device info, screen metrics, keyboard, and status-bar utilities - Bundles encryption helpers for AES, DES, RSA, MD5, SHA, and Base64 - Supplies network, Wi-Fi, phone state, and connectivity check methods ## Architecture Overview The library is organized into two modules: utilcode (core utilities with no UI dependency) and utilcodex (AndroidX-compatible superset). Each utility is a standalone static-method class that initializes lazily from the Application context provided at startup. The modular design means unused classes are stripped by ProGuard or R8 during release builds. ## Setup & Configuration - Add the JitPack repository and the utilcodex dependency to your Gradle file - Call Utils.init(application) in your Application.onCreate method - Access any utility through its static class, e.g., FileUtils.copy(), ScreenUtils.getScreenWidth() - ProGuard rules are bundled automatically via consumerProguardFiles - Use the sub-library utilcode instead of utilcodex if you target the legacy support library ## Key Features - Over 30 utility categories covering nearly every common Android boilerplate task - Consistent API surface with Javadoc for every public method - Lightweight per-class footprint thanks to static utility design and tree-shaking support - Built-in bus module for simple cross-component messaging without third-party event libraries - Actively maintained with regular updates for new Android API levels ## Comparison with Similar Tools - **Guava (Android subset)** — broader scope but heavier; AndroidUtilCode is Android-specific and lighter - **Apache Commons Lang** — Java-only utilities without Android-specific helpers like toast, permission, or screen utils - **Anko** — Kotlin DSL extensions for Android, now deprecated; AndroidUtilCode is Java-first and still maintained - **AndroidX Core KTX** — Kotlin extensions for Jetpack; AndroidUtilCode provides a wider utility surface for Java projects - **TinyPinyin / OkHttp** — single-purpose libraries; AndroidUtilCode consolidates many small concerns into one dependency ## FAQ **Q: Does it support Kotlin projects?** A: Yes. All utilities are callable from Kotlin, and the library is compatible with Kotlin-based Android projects. **Q: Will it increase my APK size significantly?** A: Unused utility classes are removed by R8/ProGuard, so the final impact is limited to the classes you actually reference. **Q: Is it compatible with Jetpack Compose?** A: Non-UI utilities like FileUtils, EncryptUtils, and NetworkUtils work in any Android project. View-specific helpers are designed for the traditional View system. **Q: What is the minimum Android API level?** A: The library supports API 14 and above, covering the vast majority of active Android devices. ## Sources - https://github.com/Blankj/AndroidUtilCode - https://github.com/Blankj/AndroidUtilCode/blob/master/lib/utilcode/README.md --- Source: https://tokrepo.com/en/workflows/asset-40366528 Author: AI Open Source