Skip to content

Instantly share code, notes, and snippets.

@AsaiToshiya
Last active October 17, 2020 07:59
Show Gist options
  • Save AsaiToshiya/044e852c21c0c2ae0c4aa4dcfea37e99 to your computer and use it in GitHub Desktop.
Save AsaiToshiya/044e852c21c0c2ae0c4aa4dcfea37e99 to your computer and use it in GitHub Desktop.
Mono を Android にインストールする

Mono を Android にインストールする

手順

1. Termux をインストール

https://play.google.com/store/apps/details?id=com.termux

2. wget をインストール

$ pkg install wget

3. $PREFIX に移動

$ cd $PREFIX

4. Mono をインストール

インストールするファイルは、端末の CPU アーキテクチャーによって異なる。

ARM64:

$ wget https://github.com/IanusInferus/termux-mono/releases/download/v20201017/mono-termux.6.12.0.90-arm64-androideabi24.tar.xz
$ tar Jxf mono-termux.6.12.0.90-arm64-androideabi24.tar.xz
$ rm mono-termux.6.12.0.90-arm64-androideabi24.tar.xz

ARMv7:

$ wget https://github.com/IanusInferus/termux-mono/releases/download/v20201017/mono-termux.6.12.0.90-armv7a-androideabi21.tar.xz
$ tar Jxf mono-termux.6.12.0.90-armv7a-androideabi21.tar.xz
$ rm mono-termux.6.12.0.90-armv7a-androideabi21.tar.xz

5. Mono のパスを通す

$ echo 'export PATH=$PREFIX/local/bin:$PATH' >> ~/.bash_profile
$ source ~/.bash_profile

6. インストールを確認

$ mono --version
Mono JIT compiler version 6.12.0.90 (tarball Sat Oct 17 13:58:52 CST 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  arm64
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          supported, not enabled.
        Suspend:       preemptive
        GC:            sgen

7. C# のコンパイルと実行

$ echo 'using System;class HelloWorld{static void Main(){Console.WriteLine("Hello, world!");}}' > HelloWorld.cs
$ mcs HelloWorld.cs
$ mono HelloWorld.exe
Hello, world!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment