shadowsocks-android源码Mac环境编译打包apk教程

  1. 安装homebrew包管理器

    //卸载brew命令
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
    
    //安装 brew命令
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
  2. Install Android SDK and NDK by run brew install android-ndk android-sdk
  3. 设置sdk全局变量和NDK全局变量,在~目录下新建或打开.bash_profile文件,添加两行export命令引入ndk和sdk文件夹,再在terminal执行source .bash_profile

    export ANDROID_HOME=~/sdk            
    export ANDROID_NDK_HOME=~/ndk/android-ndk-r10e 
    
  4. cd 进入sdk目录下tools子目录,运行两个命令更新sdk

    echo "y" | ./android update sdk --filter tools,platform-tools,build-tools-23.0.2,android-23,extra-google-m2repository --no-ui -a
    
    echo "y" | ./android update sdk --filter extra-android-m2repository --no-ui --no-https -a
    
  5. cd进入shadowsocks-android目录执行

    submodule update --init ```
    1
    6. 安装sbt:``` brew install sbt

  6. 生成keystore文件和Create local.properties from local.properties.example

    keytool -genkey -v -keystore release.keystore -alias release -keyalg RSA -keysize 2048 -validity 10000
    
  7. sbt编译

    // Build native binaries
    ./build.sh
    
    // Build the apk
    sbt clean android:package-release