retrofit

Configure Retrofit service interfaces with OkHttp, converters, and token authentication.

14|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/piyushverma0/android-agent-skills --skill retrofit-piyushverma0
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: retrofit
Source: https://github.com/piyushverma0/android-agent-skills/tree/main/skills/retrofit
Command: npx skills add https://github.com/piyushverma0/android-agent-skills --skill retrofit-piyushverma0

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Retrofit setup for Android AI agents can be verbose and error-prone, leading to boilerplate, inconsistent error handling, and fragmented API integration.

Core Features & Use Cases

  • Type-safe API interfaces using Retrofit annotations.
  • Integrated OkHttp client with interceptors, logging, and timeouts.
  • JSON parsing with kotlinx.serialization and a unified error handling strategy.
  • Token-based authentication with automatic retry via TokenAuthenticator.
  • File upload support, progress tracking, and consistent network result wrappers.

Quick Start

Create a Retrofit-based API service, configure an OkHttp client and a Json converter, and start calling endpoints.

Frequently Asked Questions about retrofit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Retrofit for Android to handle REST API calls and JSON parsing?

Retrofit setup for Android involves defining type-safe service interfaces using annotations, configuring an OkHttp client with timeouts, and adding a kotlinx.serialization converter for JSON parsing. This streamlines REST API communication and reduces boilerplate.

How does token authentication work with Retrofit and OkHttp on Android?

Token authentication in Retrofit uses a TokenAuthenticator to automatically refresh expired tokens and retry failed HTTP requests. This ensures robust network calls without manual intervention when an authentication token expires.

Does Retrofit support file uploads and progress tracking for Android apps?

Yes, Retrofit supports file uploads with progress tracking on Android. It integrates with OkHttp to monitor upload progress and uses uniform network result wrappers to handle successful and failed data fetching consistently.

What is the best way to handle errors and timeouts in Android REST API requests?

The best way to handle REST API errors and timeouts is by configuring an integrated OkHttp client with interceptors, logging, and a unified error handling strategy. This provides resilient data fetching across typical API workflows.

Can I use kotlinx.serialization with Retrofit for type-safe network calls on Android?

Yes, you can use kotlinx.serialization with Retrofit for type-safe network calls. By configuring a JSON converter, the networking stack parses responses consistently and integrates error handling across API workflows.