编译 XposedBridge

Posted by API Caller on November 1, 2018

XposedBridge 最新 89 版本编译.

本文环境

  • Windows 10 x64
  • Android Studio 3.1.3

具体流程

  • 下载源码 XposedBridge 的源码
  • build.gradle 中的 com.android.tools.build:gradle 版本改为 3.2.0
  • 打开 /gradle/wrapper/gradle-wrapper.properties , 修改 gradle 版本为 4.6
  • sdk 版本改为 23
  • build tool 版本改为 23.0.3
  • 用 Android Studio 打开, 提示缺啥就装啥
  • 一切就绪后(无视类似 Cause: compileSdkVersion is not specified. 的报错 !!! 被这个坑惨了), 打开 Android Studio 的 Terminal, 运行 gradlew generateAPI 即可得到 api.jar 和 api-sources.jar.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
sudo apt-get install openjdk-8-jdk

curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk version


sdk install gradle 3.2


mkdir androidsdk && cd androidsdk
export ANDROID_HOME=$(pwd)


wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$PATH

yes | sdkmanager --licenses --verbose

sdkmanager "build-tools;23.0.3" "platforms;android-23" "sources;android-23" --verbose

# deps for 32-bit aapt
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
sudo apt-get install  lib32ncurses5 lib32z1

# wsl run 32-bit aapt
# https://github.com/microsoft/wsl/issues/2468#issuecomment-374904520

gradle wrapper # https://askubuntu.com/questions/1044352/how-to-install-gradle-and-gradlew/1044366#1044366
./gradlew jarStubs
./gradlew jarStubsSource
# ./gradlew generateAPI 

ls app/build/api/*.jar -l