Skip to content

lxzh/SecShell

Repository files navigation

SecShell

中文说明

1. prepare sdk

  • build sdk

build the sdk to be reinforced, such as libcore

gradle libcore:build
  • unzip aar

unzip the release sdk aar in libcore/build/outputs/aar/libcore-release.aar, get the jar libcore.jar file in the aar package, copy libcore.jar to libsag/output for generating stub-sdk

  • jar to dex

transfore the jar file to dex file, because BaseDexClassLoader cannot load normal jar package, so we need to convert the jar to dex package with dx tool in android sdk:

dx --dex --output=libcore.dex libcore.jar

or d2j-jar2dex.bat:

d2j-jar2dex.bat libcore.jar -o libcore.dex

then copy libcore.dex to libmix/output generate mixed dex

2. sdk proguard

  • encrypt sdk

use libmix to encrypt sdk

gradle libmix:build

build libmix to exec encrypt task, the build script will automatically encrypt the dex and copy it to libshell/src/main/assets/

  • generate stub-sdk

To hide the key code of our sdk and ensure that users can develop properly, we provide stub-sdk for user compileOnly reference, and load the actual SDK through shell tools. In this scheme, the stub-sdk is generated based on the reflection principle of Java. Empty Java classes are generated by loading the jar file in the aar package of SDK.

gradle libsag:build
  • build stub-sdk
gradle corestub:build

build corestub to generate corestub.aar for compileOnly use in user app, the build script will automatically copy it to demo/geetestsdk/

3. build demo

gradle demo:build

build the demo project to get example apk