# A3: Assisting Android API Migrations Using Code Examples

**Authors:** Maxime Lamothe, Weiyi Shang, Tse-Hsun Chen

arXiv: 1812.04894 · 2021-03-29

## TL;DR

This paper presents a method that learns API migration patterns from code examples to assist Android developers in migrating APIs, significantly reducing effort and improving accuracy.

## Contribution

It introduces a novel approach that automatically learns API migration patterns from code examples and applies them to real Android apps, aiding developers in migration tasks.

## Key findings

- Successfully learned API migration patterns in 71 out of 80 cases.
- Reduced API migration time by an average of 29%.
- Enhanced developer support through automated migration suggestions.

## Abstract

The fast-paced evolution of Android APIs has posed a challenging task for Android app developers. To leverage Android's frequently released APIs, developers must often spend considerable effort on API migrations. Prior research and Android official documentation typically provide enough information to guide developers in identifying the API calls that must be migrated and the corresponding API calls in an updated version of Android (what to migrate). However, API migration remains a challenging task since developers lack the knowledge of how to migrate the API calls. There exist code examples, such as Google Samples, that illustrate the usage of APIs. We posit that by analyzing the changes of API usage in code examples, we can learn API migration patterns to assist developers with API Migrations.   In this paper, we propose an approach that learns API migration patterns from code examples, applies these patterns to the source code of Android apps for API migration, and presents the results to users as potential migration solutions. To evaluate our approach, we migrate API calls in open source Android apps by learning API migration patterns from code examples. We find that our approach can successfully learn API migration patterns and provide API migration assistance in 71 out of 80 cases. Our approach can either migrate API calls with little to no extra modifications needed or provide guidance to assist with the migrations. Through a user study, we find that adopting our approach can reduce the time spent on migrating APIs, on average, by 29%. Moreover, our interviews with app developers highlight the benefits of our approach when seeking API migrations. Our approach demonstrates the value of leveraging the knowledge contained in software repositories to facilitate API migrations.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1812.04894/full.md

## Figures

5 figures with captions in the complete paper: https://tomesphere.com/paper/1812.04894/full.md

## References

85 references — full list in the complete paper: https://tomesphere.com/paper/1812.04894/full.md

---
Source: https://tomesphere.com/paper/1812.04894