← Back to daimajia/AndroidViewAnimations

How to Deploy & Use daimajia/AndroidViewAnimations

Android View Animations Deployment and Usage Guide

Prerequisites

  • Android Studio (recommended) or any Java IDE
  • Android SDK with API level 14 or higher
  • Gradle build system (included with Android Studio)
  • Java Development Kit (JDK) 8 or higher

Installation

Option 1: Using Gradle (Recommended)

Add the dependency to your build.gradle file:

dependencies {
    implementation 'com.daimajia.androidanimations:library:2.4@aar'
}

Option 2: Using Maven

Add the dependency to your pom.xml file:

<dependency>
    <groupId>com.daimajia.androidanimation</groupId>
    <artifactId>library</artifactId>
    <version>2.4</version>
</dependency>

Configuration

No additional configuration is required. The library is self-contained and does not require API keys or external services.

Build & Run

Local Development

  1. Import the library into your Android project
  2. Sync Gradle files to download dependencies
  3. Build the project using:
    ./gradlew build
    
  4. Run on emulator or device using:
    ./gradlew installDebug
    

Using Animations in Your App

// Basic usage
YoYo.with(Techniques.Tada)
    .duration(700)
    .repeat(5)
    .playOn(findViewById(R.id.edit_area));

// With custom interpolator
YoYo.with(Techniques.Swing)
    .duration(1200)
    .repeat(YoYo.INFINITE)
    .pivot(YoYo.CENTER_PIVOT, YoYo.CENTER_PIVOT)
    .interpolate(new AccelerateDecelerateInterpolator())
    .playOn(findViewById(R.id.hello_world));

Available Animation Techniques

Attention: Flash, Pulse, RubberBand, Shake, Swing, Wobble, Bounce, Tada, StandUp, Wave

Special: Hinge, RollIn, RollOut, Landing, TakingOff, DropOut

Bounce: BounceIn, BounceInDown, BounceInLeft, BounceInRight, BounceInUp

Fade: FadeIn, FadeInUp, FadeInDown, FadeInLeft, FadeInRight, FadeOut, FadeOutDown, FadeOutLeft, FadeOutRight, FadeOutUp

Flip: FlipInX, FlipOutX, FlipOutY

Rotate: RotateIn, RotateInDownLeft, RotateInDownRight, RotateInUpLeft, RotateInUpRight, RotateOut, RotateOutDownLeft, RotateOutDownRight, RotateOutUpLeft, RotateOutUpRight

Slide: SlideInLeft, SlideInRight, SlideInUp, SlideInDown, SlideOutLeft, SlideOutRight, SlideOutUp, SlideOutDown

Zoom: ZoomIn, ZoomInDown, ZoomInLeft, ZoomInRight, ZoomInUp, ZoomOut, ZoomOutDown, ZoomOutLeft, ZoomOutRight, ZoomOutUp

Deployment

This is a library project, not an application. To deploy your app using this library:

  1. Build your APK using:
    ./gradlew assembleRelease
    
  2. Sign your APK following Android's signing guidelines
  3. Publish to Google Play Store or distribute via other channels

Troubleshooting

Common Issues

Issue: Animation not working

  • Solution: Ensure you're using API level 14 or higher and have properly imported the library

Issue: Gradle sync fails

  • Solution: Check your internet connection and verify the dependency version in your build.gradle file

Issue: Animation conflicts with other libraries

  • Solution: This library uses Android's native animation framework, so conflicts are rare. If issues occur, try adjusting animation durations or using different techniques

Issue: Memory leaks with animations

  • Solution: Always stop animations when views are destroyed:
    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (rope != null) {
            rope.stop(true);
        }
    }
    

Performance Tips

  • Use shorter durations for better performance on older devices
  • Avoid infinite loops in production unless necessary
  • Test animations on actual devices, not just emulators

Version Compatibility

  • Version 2.4+ removes dependency on NineOldAndroids
  • Compatible with Android API 14+ (Ice Cream Sandwich)
  • Works with AndroidX and modern Android development practices