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
-
Create an Android project
-
Maven integration
-
Check Maven Central Hippy version, where
hippy-commonis thereleaseversion (does not carryinspector) andhippy-debugis thedebugversion -
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' -
-
Local integration (optional)
- Demo Project run Gradle Task
other => assembleReleaseorother => assembleDebugwill generatereleaseordebugmodeandroid-sdk.aarin theandroid\sdk\build\outputs\aardirectory. Then copyandroid-sdk.aarto your project'slibsdirectory.
!> The AAR generated by the
assembleReleasetask does not carry theinspectormodule 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' - Demo Project run Gradle Task
-
Inherit
HippyImageLoaderand implement your own image loader, you can refer to Demo project inMyImageLoaderimplementation. -
Add engine initialization and
hippyRootViewmounting logic in the host APP project, please refer to Demo project implementation ofMyActivity.