Configs2026年7月23日·1 分钟阅读

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.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
AndroidUtilCode
直接安装命令
npx -y tokrepo@latest install 40366528-86d7-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

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

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产