Skip to main content
QUICK REVIEW

[Paper Review] A4: Automatically Assisting Android API Migrations Using Code Examples.

Maxime Lamothe, Weiyi Shang|arXiv (Cornell University)|Dec 12, 2018
Software Engineering ResearchComputer Science62 references14 citations
TL;DR

This paper proposes A4, an approach that automatically learns Android API migration patterns from code examples—such as Google Samples—and applies them to real Android apps. By analyzing usage changes in examples, A4 successfully assists in API migration in 71 out of 80 cases, either auto-migrating calls or providing actionable guidance.

ABSTRACT

The fast-paced evolution of Android APIs has posed a challenging task for Android app developers. To leverage the newly and frequently released APIs from Android, developers often must spend considerable effort on API migrations. Prior research work and Android official documentation typically provide enough information to guide developers in identifying both the changed API calls that need to be migrated and the corresponding API calls in the new version of Android (what to migrate). However, the API migration task is still challenging since developers lack the knowledge of how to migrate the API calls. In addition to the official documentation, 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 may be able to learn API migration patterns to assist developers with API migrations. In this paper, we propose an approach that automatically learns API migration patterns from code examples and applies these patterns to the source code of Android apps for API migration. To evaluate our approach, we migrate API calls in open source Android apps by learning API migration patterns from both public and manually generated code examples. We find that our approach can successfully learn API migration patterns and provide API migration assistance in 71 out of 80 cases. In particular, our approach can either automatically migrate API calls with little to no extra modifications needed or provide guidance to assist with the migrations. Our approach can be adopted by Android developers to reduce the effort they spend on regularly migrating Android APIs.

Motivation & Objective

  • Address the challenge of manual, time-consuming Android API migrations due to frequent API changes.
  • Overcome the gap in developer knowledge about *how* to migrate APIs, beyond just knowing *what* to migrate.
  • Leverage publicly available code examples (e.g., Google Samples) to extract reusable migration patterns.
  • Develop an automated system that applies learned patterns to real Android app code for practical migration assistance.

Proposed method

  • Analyze changes in API usage across versions in public code examples like Google Samples to extract migration patterns.
  • Model API migration patterns as transformation rules that map old API calls to new ones with corresponding usage semantics.
  • Parse and compare ASTs (Abstract Syntax Trees) of code examples across Android versions to detect semantic changes in API usage.
  • Apply learned migration patterns to source code of open-source Android apps to suggest or perform automatic migrations.
  • Use heuristics and syntactic/semantic matching to validate and refine migration suggestions before application.

Experimental results

Research questions

  • RQ1Can code examples effectively reveal reusable patterns for Android API migrations?
  • RQ2To what extent can automatically learned migration patterns be applied to real-world Android applications?
  • RQ3How accurate and practical are the migration suggestions generated by the proposed approach in real migration scenarios?
  • RQ4Can the system reduce developer effort in API migration compared to manual migration using official documentation alone?

Key findings

  • The proposed approach successfully learned and applied API migration patterns in 71 out of 80 tested cases.
  • In 71% of cases, the system either automatically migrated API calls with minimal or no manual intervention.
  • For the remaining 9 cases, the system provided actionable guidance that could assist developers in completing the migration.
  • The approach outperformed reliance on official documentation alone by providing concrete, usage-based migration examples.
  • The system demonstrated practical applicability on real open-source Android apps, showing strong potential for integration into development workflows.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.