# Install in an Android app

## Step 1: Add Dependency

In your app-level `build.gradle` file with the latest version:

Go to the following link for latest version:\
<https://central.sonatype.com/artifact/ai.zipy/zipy-android>&#x20;

```gradle
dependencies {
    implementation 'ai.zipy:zipy-android:1.0.1'
}
```

## Step 2: Initialize SDK

Initialize Zipy as early as possible (typically inside `Application` class).

```java
import com.zipy.zipyandroid.Zipy;

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        // Provide application context
        Zipy.setApplicationContext(application);
        // Initialize with API Key
        Zipy.init("YOUR_API_KEY");
    }
}

```

If you just want the latest version without hardcoding the number—which gives you flexibility but reduces clarity—you can use a dynamic version specifier:

```gradle
dependencies {
    implementation 'ai.zipy:zipyandroid:+'
}
```

Add these rules in proguard rules file if you are minifying code in release

```
-dontwarn com.zipy.zipyandroid.**
-keep class com.zipy.zipyandroid.** { *; }
-keepclassmembers class com.zipy.zipyandroid.** { *; }
-keepattributes *Annotation*,Signature,EnclosingMethod

# Prevent protobuf Lite classes (used by Zipy events/types) from being stripped/obfuscated.
# The crash "Field kind_ for j3.z1 not found" indicates Value/Struct fields were obfuscated.
-dontwarn com.google.protobuf.**
-keep class com.google.protobuf.** { *; }
-keepclassmembers class com.google.protobuf.** { *; }

# Keep generated proto event classes under types.* to preserve field names for reflection.
-dontwarn types.**
-keep class types.** { *; }
-keepclassmembers class types.** { *; } 
```
