Integrate Baseline Profiles in Android Apps with Appdome

Last updated September 16, 2024 by Appdome

Discover how to effectively enhance Android app performance by customizing your app with Baseline Profile in a mobile CI/CD environment using Appdome’s Data-Driven DevSecOps™ build system.

What is the Baseline Profile Optimization Feature?

Appdome’s integration with Baseline Profile enables Android developers to enhance application performance through Ahead-of-Time (AOT) compilation by optimizing specified code paths. The Baseline Profile consists of a .txt file that lists methods and their respective “hotness” levels, determined by various flags. Developers create this file using Android Studio, which then compiles it into a .prof file—an index of methods within the application’s DEX files. Additionally, a .profm file is used for compatibility with different versions of the Android Runtime (ART).

When Appdome protections are applied, the original DEX files are modified, rendering the existing .prof file inaccurate as it no longer corresponds to the methods listed in the .txt file. Appdome addresses this by regenerating the .prof file according to the protected APK, ensuring that performance enhancements remain effective after security measures are implemented.

How Does Appdome Protect Mobile Apps with Baseline Profile Optimization?

Appdome provides the option to upload profile.txt files via the –baseline_profile switch. Once uploaded, Appdome regenerates the baseline.prof file to align with the protected app, replacing the original .prof file. This process ensures that the performance optimizations are preserved even after security protections are applied.

The feature is implemented through Appdome’s API to facilitate seamless integration and customization within CI/CD pipelines, ensuring that Baseline Profile management is dynamic and aligned with each new build from Android Studio. This approach is operational from a customer’s standpoint as it allows setting up the profile programmatically rather than through the UI, which is crucial since the file changes with every build.

For detailed guidance on how to upload and integrate your Baseline Profile via Appdome’s API, please refer to the Appdome API documentation.

Prerequisites for Using App Customization with Baseline Profile:

To use Appdome’s mobile app security build system to Customize an App with a Baseline Profile, you’ll need the following:

Steps to Integrate Baseline Profile:

  1. Upload a Mobile app to Appdome
    • Upload Method: Appdome Console or DEV-API
    • Android Formats: .apk or .aab
  2. Create and name the Fusion Set (security template) that will contain the security feature.
  3. Select the Fusion Set you wish to use within the Appdome platform.
  4. Open the Fusion Set Detail Summary by clicking the “…” symbol on the far-right corner of the Fusion Set.
    Fusion Set Details
  5. Copy the Fusion Set ID from the Fusion Set Detail Summary. This is crucial, as you will need it to make the API call.
    Copy Fs Id
  6. Copy the App ID
    Copy App Id
  7. Setup your API call
  8. Prepare to make a POST request to the appropriate Appdome API endpoint.
  9. Refer to the image provided for the correct parameter setup:
    API Parameter Setup
  10. Configure the API Parameters:
    • app_id: The unique identifier for your app obtained from the upload response.
    • fusion_set_id: The Fusion Set ID you copied earlier.
    • action: Set this to “fuse” to initiate the integration process.
    • baseline_profile: Attach the profiles.zip file, which contains your Baseline Profile.
  11. Send the API Request
  12. Appdome’s system will process the Baseline Profile along with your specified Fusion Set and apply the necessary configurations to your app.
  13. Verify the Integration

After the API call, you can verify the integration by checking the build status on the Appdome platform. Ensure that the Baseline Profile has been correctly applied as per your configuration.

After successfully integrating the Baseline Profile using the API, your Android app will benefit from optimized performance through the enhanced specific code paths. This integration not only improves app performance but also maintains the efficacy of security measures provided by Appdome.

This streamlined process simplifies the integration of performance optimization features without the need for manual adjustments in the Fusion Set, allowing for greater flexibility and efficiency in your CI/CD pipeline.

Related Articles:

How Do I Learn More?

If you have any questions, please send them our way at support.appdome.com or via the chat window on the Appdome platform.

Thank you!

Thanks for visiting Appdome! Our mission is to secure every app on the planet by making mobile app security easy. We hope we’re living up to the mission with your project.

Appdome

Want a Demo?

Mobile RASP Security

GilWe're here to help
We'll get back to you in 24 hours to schedule your demo.