Usage Instructions

Updated at:

Security hardening has the following requirements for APK and AAB files. Review these instructions before you begin.

  • Ensure that the onCreate method of a Provider can be executed multiple times. For example, if you initialize a singleton in onCreate, check whether the instance has already been initialized.

  • The x86 and MIPS architectures are not supported. If your application is configured for these architectures, remove them and repackage your application.

  • minSdkVersion 24 and higher are not supported. Set minSdkVersion to 23 or lower. When minSdkVersion is less than 23, security hardening compresses the native libraries in the APK by default. To set minSdkVersion to 23, use one of the following methods:

    • Add android:extractNativeLibs="true" to the application node property.

    • Repackage the hardened APK or AAB and configure compression based on your requirements.

    Important

    To harden the Assets files in your application, minSdkVersion must be 21 or higher (Android 5.0 or later).

  • If your project uses ARouter, use the Gradle plugin to automatically load the route table.

    apply plugin: 'com.alibaba.arouter'// Configure this in the build.gradle file of your project's app module.
    
    buildscript {
     repositories {
     mavenCentral()
     }
    
     dependencies {
     classpath "com.alibaba:arouter-register:?"
     }
    }

    The ARouter registration plugin loads the route table automatically by scanning DEX files. This feature is powered by AutoRegister. Using the Gradle plugin shortens initialization time and prevents failures caused by security hardening blocking direct access to DEX files.

    Important
    • This plugin requires API version 1.3.0 or later.

    • For more information, see the ARouter instructions.