Skip to content

How to use advanced features

Androidの設定

Herculesの追加機能を使用するには、Android Gradleモジュールでprefab機能が有効になっている必要があります。

Android Studioプロジェクトの設定

  • Android Gradle Plugin 4.1未満使用時

    • gradle.propertiesファイルに以下のように追加します。

      android.enablePrefab=true
      
  • Android Gradle プラグイン 4.1 以上を使用する場合

    • build.gradle ファイルにある android ブロックに以下のように追加します。

      android {
          ...
          buildFeatures {
                  prefab true
          }
      }
      
  • In your module-level build.gradle file, add the following libraries to the dependencies section:

    dependencies {
        implementation "com.com2us.android.hive:hive-hercules"
        implementation "com.com2us.android.gamesec:hercules:20250527" // For using Hercules additional features
    

CMake / ndk-build Configuration (for C/C++ Usage)

  • When using NDK r21 or higher

    // When using CMake
    find_package(Hercules REQUIRED CONFIG)
    
    target_link_libraries(
        ...
        Hercules::Hercules
    )
    
    // When using Android.mk
    LOCAL_SHARED_LIBRARIES := Hercules
    
    include $(BUILD_SHARED_LIBRARY)
    
    ifneq ($(call ndk-major-at-least,21),true)
        $(call import-add-path,$(NDK_GRADLE_INJECTED_IMPORT_PATH))
    endif
    $(call import-module, prefab/Hercules)
    
  • When using NDK r21 or lower

    • Add the Hercules.h file to your project separately, and link the .so file directly by specifying its path.

      // When using CMake
      target_link_libraries(
          ...
          ${CMAKE_CURRENT_SOURCE_DIR}/../build/intermediates/merged_native_libs/${CMAKE_BUILD_TYPE}/out/lib/${ANDROID_ABI}/libHercules.so
      )
      
      // When using Android.mk
      include $(CLEAR_VARS)
      LOCAL_MODULE := Hercules
      LOCAL_SRC_FILES := ../build/intermediates/merged_native_libs/release/out/lib/$(TARGET_ARCH_ABI)/libHercules.so
      include $(PREBUILT_SHARED_LIBRARY)
      LOCAL_SHARED_LIBRARIES := Hercules
      

iOSの設定

設定方法

  • CocoaPodsを通じてプロジェクトにインストールされたHerculesフレームワークのパス以下で.hを見つけてプロジェクトにimportします。
    シミュレーターまたはデバイスターゲットパスに含まれているヘッダーの中から何でも選んで使用しても問題ありません。
    パスは次の通りです。
    `${PROJECT_ROOT_DIR}/Pods/Hercules/Hive_SDK_iOS_External_${HIVE_SDK_VERSION}/Hercules.xcframework/${SIMULATOR_OR_PHONEOS}/Hercules.framework/Headers/Hercules.h`
    

Unityを設定する

プロジェクト設定を行う

  • UnityのプリプロセッサフラグにUSE_HERCULESを追加します。

    • Player Settings → Other Settings → Script Compilation → Scripting Define Symbols

  • ‘unsafe’ コードを許可するようにチェックします。

    • プレイヤー設定 → その他の設定 → スクリプトコンパイル → ‘unsafe’ コードを許可

Unrealの設定

Hive SDK Unreal Pluginが含むヘラクレスモジュールはヘラクレスの追加機能をサポートしていません。
Unreal環境でヘラクレスの追加機能を使用するには、以下を参照してください。