title: Why can't MonoDroid find my assemblies?
body: <p>I made a simple Android HelloWorld app using Xamarin Studio 4.2.3 that doesn't do anything except it prints out some message if a random number is greater than 0.5. It works just great on a Nexus 4 and a Nexus 5.</p>
  
  <p>The next thing I'm doing is to extract the .dll with the code from the app's apk (from the assemblies folder) using 7Zip. Using .Net Reflector and Reflexil I'm modifying a single instruction, usually the brfalse.s that gets generated by the IF statement in "if(rand.nextDouble()>0.5){doStuff()}" such that it branches to the instruction right in front of the call to doStuff(), thereby effectively making the IF statement useless and ensuring the method always gets called.</p>
  
  <p>Next I'm saving the patched .dll, replacing the original one in the .apk with the patched one, sign and zipalign the .apk and finally I'm installing it using adb.</p>
  
  <p>When I'm launching the app on my phones it crashes directly and LogCat shows the following:</p>
  
  <pre class="lang-none prettyprint-override"><code>03-20 10:12:08.709: I/ActivityManager(764): Start proc HelloMonoLVL.HelloMonoLVL for activity HelloMonoLVL.HelloMonoLVL/hellomonolvl.hellomonolvl.TrialSplashScreen: pid=23099 uid=10128 gids={50128} 
  03-20 10:12:08.729: D/dalvikvm(23099): Trying to load lib /data/app-lib/HelloMonoLVL.HelloMonoLVL-1/libmonodroid.so 0x427154a0
  03-20 10:12:08.729: D/dalvikvm(23099): Added shared lib /data/app-lib/HelloMonoLVL.HelloMonoLVL-1/libmonodroid.so 0x427154a0
  03-20 10:12:08.739: W/libc(23099): WARNING: generic atexit() called from legacy shared library 
  03-20 10:12:08.759: W/monodroid-gc(23099): GREF GC Threshold: 46800 
  03-20 10:12:08.769: A/monodroid-assembly(23099): Coult not load assembly 'HelloMonoLVL' during startup registration. 
  03-20 10:12:08.769: A/monodroid-assembly(23099): This might be due to an invalid debug instalation. 
  03-20 10:12:08.769: A/monodroid-assembly(23099): A common cause is to 'adb install' the app directly instead of doing from the IDE. 
  03-20 10:12:08.789: I/ActivityManager(764): Process HelloMonoLVL.HelloMonoLVL (pid 23099) has died. 
  03-20 10:12:08.789: W/ActivityManager(764): Force removing ActivityRecord{42752a50 u0 HelloMonoLVL.HelloMonoLVL/hellomonolvl.hellomonolvl.TrialSplashScreen t238}: app died, no saved state
  </code></pre>
  
  <p>Since this didn't work I used the C# port of the LVL. Built the LVL sample app, deployed and it works on the phones. I again extracted the .dll with the license verification code, using Reflexil I changed the code of a method, injected the patched .dll in the apk, signed and zipaligned the apk. Again it doesn't work but crashes on launch and I now get:</p>
  
  <pre class="lang-none prettyprint-override"><code>03-20 10:21:19.049: D/dalvikvm(23507): Trying to load lib /data/app-lib/de.marius.lvl-1/libmonodroid.so 0x42711448 
  03-20 10:21:19.049: D/dalvikvm(23507): Added shared lib /data/app-lib/de.marius.lvl-1/libmonodroid.so 0x42711448 
  03-20 10:21:19.069: A/MonoDroid(23507): No assemblies found in '/data/data/de.marius.lvl/files/.__override__' or '/storage/emulated/0/Android/data/de.marius.lvl/files/.__override__'. Assuming this is part of Fast Deployment. Exiting... 
  03-20 10:21:19.079: I/ActivityManager(764): Process de.marius.lvl (pid 23507) has died. 
  03-20 10:21:19.079: W/ActivityManager(764): Force removing ActivityRecord{42bc3c60 u0 de.marius.lvl/.TrialSplashScreen t239}: app died, no saved state
  </code></pre>
  
  <p>It doesn't seem to make any difference if I'm using the apk that Xamarin generates in Release mode or Debug mode. I tried both using the apk versions from the bin folder of the project and the ones I pulled from the phone with adb pull.</p>
  
  <p>I'm new to Xamarin so maybe my approach is naive. Is there something like a hash check that my patched .dlls don't pass? I saw that Reflexil has an option to remove StrongNames, I tried that but it didn't seem to make any difference (but I must admit I don't really know how those work).</p>
  
  <p>Is it even possible what I'm trying to do?
  Any help is much appreciate.</p>