> For the complete documentation index, see [llms.txt](https://documentation.virbox.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.virbox.com/use-cases/protect-unity3d-ue4-application/protect-unity3d-android-apk.md).

# Protect Unity3D Android APK

​

## Protect Unity3D Android APK

### Introduction

**Virbox Protector** support to protect/encrypt the Unity3D Android APK compiled in Mono framework and IL2CPP mode.

Virbox Protector supports to protect Unity3D Android APK in both GUI tool and CLI tool.

With Virbox Protector, Developer protect/encrypt the whole Unity3D directory and critical libs and data assets for Unity3D android Apk, includes:&#x20;

<mark style="color:blue;">Assembly-CSharp-firstpass.dll,  Assembly-CSharp.dll,   global-metadata.dat, other C# assemblies  ​ and Unity3D data assets （.resS and resource)</mark>

​and also to protect the Unity3D Android APK in general protection with following functions:&#x20;

Anti- debugging, Anti-Injection and other features.&#x20;

Here we use Virbox Protector GUI tool to show the protection process to Unity3D android APK step by step. and introduce the protection process by Virbox Protector CLI tool in second part.

For more detail, you may also refer to the User Manual\_Virbox Protector Standalone or contact us.

### Protect Unity3D Android APK in 6 steps

1. Import Android Unity3D APK: Drag related APK into Virbox Protector;
2. Setting to protect the C# dll, gloabl metadata and protect Unity3D APK in general in "Protection Option" tab;
3. Setting to protect the Unity3D APK Resource in "Resource Encryption";
4. Protect Unity3D External Resource in "Resource Encryption"
5. Click to start "Protection" Process;
6. Back up source APK and use the protected APK for further testing or distribution.

### Prerequisites

[Sign-up](/download/sign-up-and-apply-trial-license.md) Virbox Protector to apply trial license and install the Virbox Protector;

Open Virbox Protector and [sign in](/download/sign-in-and-sign-out.md) your account with your trial password

![](/files/OdB9DV2leLnAaUBaX9Zs)

{% hint style="info" %}
Above prerequisites is for test/evaluation Virbox Protector only.

To protect formal and commercial release software, pls purchase and get the related Virbox Protector license.
{% endhint %}

### Protection Process (Virbox Protector GUI tools)

#### 1. Import Android Unity3D APK:

Drag related APK into Virbox Protector; Then Virbox Protector will parse the Unity3D android APK automatically. and show Android APK information in the "Basic info" tabs, Virbox Protector support to portect  the Unity3D application both in Mono framework and IL2CPP mode. As shown as a snapshot below:

![The Unity3D Android APK complied with IL2CPP](/files/DMXbZI9yeh5Ja1plxRD8)

![The Unity3D Android APK in Mono framework](/files/BLI67BZQ0IITiN5WNDNj)

### 2. Protect the C# dll, global metadata and protect Unity3D APK in general in "Protection Option"

Go to "Protection Option" to set:

2.1 Output path and output file name, click the box in right to change output path and name; otherwise  the protectd APK file will saved in the new sub directory will be created in same directory.

2.2 Set the protection option to Android APK in General to prevent debugging and decompiling

2.3 Signature and keystore path setting

**For IL2CPP and Mono frame based APK, the configuration may slightly different:**

For metadata in IL2CPP, Virbox Protector will encrypt metadata on default.

Developer can click to select other protection option to protect APK in general; (the description/function to each protection option setting as shown as below)

Developer can click to enable signing and set the signature, input keystore file and password

For Unity3D Android APK based on Mono framework, the Virbox Protector GUI shown as attached below:

The *Assembly-CSharp-firstpass.dll*, *Assembly-CSharp.dll* will be encrypted on default by Virbox protector, you can add other C# assemblies by click "+" if necessary. and click to select other protection options, as shown attached below:

![The Unity3D Android APK in Mono framework](/files/vz2EDmXMkhxhmo68Gowr)

![The Unity3D Android APK complied with IL2CPP](/files/lzkIeZJ1ieJsgzW7cTki)

&#x20;**Protection Option Setting summary：**

Click and Select the "Memo Check", to verify memo and check memo integrity(effective to IL2CPP project);

Click and Select the "Unity Engine Encryption", to protect the unity engine and enhance security;

"Meta Data encryption", will be selected on default,  to prevent be parsed and dumped in execution;

Click and Select the "Name Obfuscation of Meta " button, to obfuscate the name of method metadata (effective to IL2CPP project);

Click and Select the "Anti-Debugging" button, then when the debugger use the IDA or other third party debug tools to debug the protected Android Apk, the protected APK will exit directly;

Click to enable the "Signature Check" and input "keystore" fileand password to prevent tampering;

{% hint style="info" %}
Click to select "Enable Sign" button to  enable "signature Check" feature.
{% endhint %}

Click and select the Anti-injection, to prevent the other session to add debugging or injection.

Click and select "Emulator Detection", to prevent the App running in the emulator environment'

Click and Select "Root Detection" to prevent the App running in the rooted device;

Click and Select "Multi-Parallel Detection" to prevent app running with multiple account;

Sign Setting

Click and "enable sign" to set/input keystore file, path and password. etc;

{% hint style="info" %}
Sign Setting

For AAB applications,

In case you click and select the "Sign check", then you can **Not** select  the Google to keep, manage your apps and password. So, you can either to select this option. but Not use Google Play store to manage the signature file, or Not select this option and use Google Play Store to manage your signature file when publish your applications;

If you use "Google" to keep and manage your keys, then the keys which used for published in Google playstore  must be consistent with the key which used in Virbox Protector.
{% endhint %}

### 3. Protect Unity3D APK Resource in "Resource Encryption" tab

Go to "Resource Encryption" tab, developer can set and protect the data assets and resource of Unit3D android APK here.

![](/files/aBTEuAPaz5gySTwt3qkR)

1. Click "Enable" to enable the "Resource Encryption", to protect the resource, data asset which attached in the Unity3D projects.
2. Click the "Favor Size", it means to set the prioritize the compression size than security, if you click to select this option, the protected APK size will much compressed, but the APK security will be lower than that of not selection of this option.
3. Click "Select Files", it will list all of resource file contained in the APK, then click to select those file which need to be encrypted.

### 4. Protect Unity3D External Resource in "Resource Encryption"

Since Unity3D projects often contain large size of AssetBundle files or other heavy resource files, developers frequently treat certain large resources (such as videos, images, or maps) as external files to improve project execution performance. Virbox Protector supports protecting both internal Unity3D resource files and related external resource files/folders. It also supports hot updates of these protected resources — meaning that when developers update resource files, they don’t need to republish the entire Unity3D project again. Instead, simply protecting/encrypting the new version of the resource file is sufficient.

**Here are process to introduce how to protect external resource in Unity3D project.**

**Parsing your unity3D project:**

Drag your unity folder into Virbox Protector; Go to `Resource Encryption` Tab;

Enable button & set password to encrypt the resource, as shown in screenshot in blow. and set/input the password:

<figure><img src="/files/PHinntkgYVUJ0N8Shqmg" alt=""><figcaption></figcaption></figure>

> Note, for Unity3D without external password, no need to input/set password. Virbox Protector will use **random key** to encrypt Resource and decrypt resource;

**Save the configuration to protection option**

Click the button in File menu: `Save Selected Configuration`

<figure><img src="/files/Q0XDjGA1ZpuD5LaTbA2Q" alt=""><figcaption></figcaption></figure>

**Encrypt the external resource**

Go to `Resource Encryption` Tab, Click the Button: `Encrypt External` on the top right of `Resource Encryption`;

\--a windows will pop up which list the external file to be protect/encrypt:

Pls refer following steps to:

* Input/Select the external resource file to be encrypted from the folder located;
* Output folder (encrypted external file folder);
* and select these external resource file to be encrypted;

and click the button `Encrypt` to encrypt these external resource file;

<figure><img src="/files/6Ii7fDwGjeuWEqT7Wepk" alt=""><figcaption></figcaption></figure>

Note:

1. When password not changed. protect the Unity folder just need to protect once;
2. When you have saved the protection configuration file (click to `Save selected configuration`), you can open the external resource file folder in `File Menu` to protect external resource file directly:

<figure><img src="/files/K64Rnlrdm5iLUCH6nClA" alt=""><figcaption></figcaption></figure>

### 5. Click to start "Protection" Process

When you finalize all above selection, click the button "Protect Selected Projects" to start the protection process (it will take some times to protect a large size of APK, pls wait)：

![](/files/bZ9WGbHlxaeS9tvT4BCm)

Go to the output folder, you will following new file has been generated

![](/files/P4Y51syO1oAHrPqTeA1s)

The first sub directory new created  :\protected, which save the protected file, entry this sub directroy, you can find the protected apk file

![](/files/LFsyhbmxWk474OQf6p3B)

The second file is source APK, it is your original APK which not protected. pls DON't distribute this APK.

The thrd file: xxxx.apk.ssp is the configuration file to save your protection options, pls keep it.

If the files protected is AAB project, similar file will be generated. but suffix is aab, not apk.

{% hint style="info" %}
pls don't use the trial version of Virbox Protector to protect and harden your APK or AAB project if you want to publish your project in the Google Store, instead to use formal release Virbox Protector to protect and harden the APK which will be published in the Google Store.
{% endhint %}

### 6. Back up source APK and use the protected APK to test etc.

Next, you need to  save the unprotect APK to another folder, keep it. don't distribute the unprotected APK to publish. and also save and keep the configuration file.

Use the protected APK  for further testing or publish or distribute later.

{% hint style="info" %}
Pls do not publish your protected app which protected by Virbox Protector trial version, pls contact our sales to get the formal release version to protect your application and published.
{% endhint %}

### Protection Process (Virbox Protector CLI tool)

#### Use Virbox Protector GUI to Generate the configuration file (Optional)

Virbox Protector support developer to protect/encrypt Unity3D Android APK with 2 ways, GUI and CLI mode. Here we introduce the protection process for how to use Virbox Protector CLI tool to protect a Unity3D Android APK,

#### 1. Generate a "configuration" file

Before to start protection, you need to generate a "configuration" file which store the setting information of "protection option" to the APK which need to protected.

Open Virbox Protector Standalone GUI tool and sign in with your account and password.

Please refer the protection process by use of Virbox Protector GUI tool in above to set the configuration to Function option, Protection option and Resource Encryption. and click "Save All Configuration" to generate the "configuration" file, which suffix is `.ssp.`&#x20;

![](/files/MC8M18VuyrVwZBnX6Xpo)

Go to the output folder, you will find a new `xxxx.apk.ssp` file has been generated in the output folder.

![](/files/hTjLh64PkfDYKIpix9qC)

&#x20;To generate a configuration file is optional, if no configuration generated, then when you use Virbox Protector CLI tool to protect APK/AAB file, the protected APK/AAB will not be signed, on default.

#### 2. Find the Virbox Protector CLI tools installed in your machine

Go to the Virbox protector's installation folder in your machine, and find the *virboxprotector\_con,exe* and open it in command line terminal:

The on default installation directory in windows system is:

`C:\Program Files\senseshield\Virbox Protector 2 Trial\bin`

The on default installation directory in Linux system is:

`/usr/share/virboxprotector/bin`

Input:

​ *`virboxprotector_con.exe`*

to view the help info:

![](/files/x0uE7au6ax0LJvBCK1b2)

#### 3 Use Virbox Protector CLI tool to protect your Unity3D Android APK

Please put the configuration file which generated by Virbox Protector GUI tool in first step into the same directory of the Unity3D Android APK located.

Use following command to execute the protection:

*`path of “VirboxProtector_con\VirboxProtector_con” “the path of the android apk to be protected\apk name” -u3d –o “the directory of the output path of the Android apk\APK name”`*

system will return with "*succeed*" when protection completed

see sample in below.

![](/files/brGHsznKRXupCr3wJTJu)

If the license of Virbox Protector to unity3D program can not be found, it shows as the snapshot below:

*error, can not find the license*

![](/files/h7jIT79W45RzkBcNDHn8)

if so, you need to contact Virbox to purchase the License of Virbox protector which commercial released and use formal license to protect your Unity3D Android APK or AAB projects.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://documentation.virbox.com/use-cases/protect-unity3d-ue4-application/protect-unity3d-android-apk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
