In the previous article, we have successfully run our hello World Program in the simulator. Here, I will first correct the previous error. Previously, I thought that monodroid could only create programs of Version 2.2 and later. So I asked everyone to download only Android SDK 2.2, but in fact the minimum version supported by monodroid is 1.6, you can set it in the properties of the project. First, right-click your project name in Solution Explorer, and click Properties. Vs will open the Project Properties window, and then select the corresponding version in the minimum android to target drop-down box. For example:
Naturally, since our program can run in the simulator, can we run it on our actual mobile phone? This is the key. First, let's see what is generated after the project is deployed. Open the bin/debug/directory where your project is located. You can see that a DLL, mdb, PDB, and two APK files are generated. Now that there is an APK, there is a play, after I connect my mobile phone to my PC via USB, I copied these two APK files to the SD card of my mobile phone. First, run the APK file name without-signed, and an error is returned, try again with-signed. The installation is successful, and you are excited and excited. Open the program immediately. An error is returned and you cannot run it. I checked the size of the APK file, which is about 100 kb. It is estimated that the mono Runtime is not packaged and installed together, so I am looking for a solution immediately. I learned through communication with the technical staff on the official website that there are two solutions to this problem:
One, copy the C:/program files/msbuild/Novell/Mono.Android.DebugRuntime-debug.apk and C:/program files/msbuild/Novell/platforms/to the mono.android.platform.apk file under your mobile androidfile and install it together.
2. Use the release version to generate your program.
Obviously, if the first method is used, it is extremely inappropriate for us to create a hello World Program with three installation files. In addition, the runtime and the two apks on the platform are both about 14 Mb in size, so we can deny the first method. The second method is used to generate the release version. Note that in the project attribute, You must select "SDK assemblies only" for linking. Use shared runtime must be deselected, for example:
After the file is generated, there will also be two APK files in the release file. Only copy the APK file with-signed to your mobile phone for installation, and then run, OK, your Hello world can finally run on your mobile phone.
The size of the APK generated by release is 4 m +, which is also a huge bully. After all, this is just a simple hello World Program, and the monodroid program inherits it. net program needs to run the platform, only from. NET framework becomes mono runtime. If you think that the program developed with monodroid is too large to accept, it is still time to give up ~~