如何使用 .Net Reactor 混淆的 Xamarin Android APK dll [英] How to use .Net Reactor obfuscated dll of Xamarin Android APK

查看:44
本文介绍了如何使用 .Net Reactor 混淆的 Xamarin Android APK dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Xamarin Android 的新手.我使用 Visual Studio 2015 社区版创建了一个应用程序.我已将解决方案配置设置为发布.

I am new to Xamarin Android. I have created an App using Visual Studio 2015 Community Edition. I have set the Solution Configuration to Release.

为了混淆,我使用了 .Net Reactor.

For obfuscation I used .Net Reactor.

这就是我试图混淆的方式

This is how I tried to obfuscate

1: 一旦我构建了应用程序,我将转到 BinRelease 文件夹

1: Once I build the App, I will go to BinRelease folder

2:混淆 App.dll

2: Obfuscate the App.dll

3:在BinRelease、ObjRelease和ObjReleaseassemblies中用混淆的dll替换原来的dll

3: Replace the original dll with obfuscated dll in BinRelease, ObjRelease and ObjReleaseassemblies

4:转到工具->Android->发布

4: Go to Tools->Android->Publish

但是当我尝试发布混淆后的 dll 将被原始 dll 替换.

However when I tried to publish the obfuscated dll will be replaced by original dll.

那我做错了什么?我是否必须手动打包apk文件.如果是这种情况,我该怎么做?

So what I am doing wrong ? Do I have to manually pack the apk file. If that is the case how can I do that?

推荐答案

1) 发布未混淆的应用程序 .apk,将其重命名为 .zip.

1) Publish not obfuscated an application .apk, rename it to .zip.

2) 将文件 Mono.Android.dll 从文件夹assemblies"移动到文件夹 YourProjectNameinRelease.

2) Move from it the file Mono.Android.dll from the folder "assemblies" into the folder YourProjectNameinRelease.

3) 创建一个新的 .NET Reactor 项目,设置正确的设置(取消选中 Anti ILDASM,同时混淆过程重命名用于反射或序列化的字段.为了避免应用程序崩溃,应该为忽略某些类型或方法设置排除项.).将此项目文件保存到 YourXamarinFolderYourProjectNameinRelease.

3) Create a new .NET Reactor project, set the right settings (uncheck Anti ILDASM, also the obfuscation process renames a fields that is used in reflection or serialization. To avoid crash of app, should set the exclusions for ignore some types or methods.). Save this project file into YourXamarinFolderYourProjectNameinRelease.

4) 创建文件obfuscate_android.bat,在此处插入代码:

4) Create the file obfuscate_android.bat, insert here the code:

 "C:Program Files (x86)Eziriz.NET ReactordotNET_Reactor.exe" -project "NET_Reactor_Project_Name.nrproj"
  copy "YourProjectName_SecureYourProjectName.dll" "YourProjectName.dll"
  DEL "YourProjectName_Secure*.dll" "YourProjectName_Secure*.pdb" /q

将此文件移动到YourProjectNameinRelease.

5) 卸载 Xamarin 项目并编辑 YourProjectName.csproj找到下一个块:

5) Unload your Xamarin project and edit YourProjectName.csproj Find the next block:

<PropertyGroup Condition = " '$ (Configuration) | $ (Platform)' == 'Release | AnyCPU'">
<! -- Insert here the link to obfuscate_android.bat -->
<PostBuildEvent>obfuscate_android.bat </ PostBuildEvent>
 </ PropertyGroup>

6) 全部保存并重新加载项目

6) Save all and Reload project

7) 运行发布.

这篇关于如何使用 .Net Reactor 混淆的 Xamarin Android APK dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆