Files
2022-08-17 17:54:24 +08:00

2.5 KiB
Executable File

Android Integration

Note: The following documents assume that you already have some experience with Android development.

This tutorial describes how to integrate Hippy into your Android project.


Preliminary Preparation

  • JDK version>=1.7 is installed and environment variables are configured
  • The latest version of Android Studio is already installed.
  • You need to install NDK, CMAKE, gradle and related plugins before running the demo project.

Demo Experience

If you want to experience it quickly, you can develop it directly based on our Android Demo

Quick Integration

  1. Create an Android project

  2. Maven integration

    • Check Maven Central Hippy version, where hippy-common is the release version (does not carry inspector) and hippy-debug is the debug version

    • Configure build.gradle

     // api 'com.tencent.hippy:hippy-debug:1.0.0'
     api 'com.tencent.hippy:hippy-common:1.0.0'
     // The glide and support-v4 are mainly for pulling image resources in the demo, but you can use your own third-party library to handle image requests.
     api 'com.github.bumptech.glide:glide:3.6.1'
     api 'com.android.support:support-v4:28.0.0'
    
  3. Local integration (optional)

    • Demo Project run Gradle Task other => assembleRelease or other => assembleDebug will generate release or debug mode android-sdk.aar in the android\sdk\build\outputs\aar directory. Then copy android-sdk.aar to your project's libs directory.

    !> The AAR generated by the assembleRelease task does not carry the inspector module by default, so you cannot debug the code on the front-end via Devtools.

    • Configure the build.gradle
     api (name:'android-sdk', ext:'aar')
     // The glide and support-v4 are mainly used to pull image resources in the demo, but you can also use your own triple library to handle image requests.
     api 'com.github.bumptech.glide:glide:3.6.1'
     api 'com.android.support:support-v4:28.0.0'
    
  4. Inherit HippyImageLoader and implement your own image loader, you can refer to Demo project in MyImageLoader implementation.

  5. Add engine initialization and hippyRootView mounting logic in the host APP project, please refer to Demo project implementation of MyActivity.