4.5 KiB
👨💻 Setup a development environment for ReVanced
A certain development environment is suggested to allow for streamlined development on ReVanced.
1. ⬇️ Clone necessary repositories
repositories=(
"revanced-cli"
"revanced-patches"
"revanced-patcher" # optional
"revanced-integrations"
)
for repository in "${repositories[@]}" ; do
git clone -b dev --single-branch --depth 1 https://github.com/revanced/$repository
done
2. 🛠️ Build from source
To build all projects, run the following command from the directory which contains the repositories
repositories=(
"revanced-cli"
"revanced-patches"
"revanced-patcher" # optional
"revanced-integrations"
)
for repository in "${repositories[@]}" ; do
cd $repository
./gradlew build
cd ..
done
3. ⚙️ Setup IntelliJ IDEA
-
Open the
revanced-cliproject in IntelliJ IDEA and ensure you are using the right JDK from 💼 Prerequisites -
Import the
revanced-patchesand optionally therevanced-patcherproject as modules into therevanced-cliproject -
Add a new Run/Debug configuration for the
revanced-cliproject; Make sure to addBefore launchtasks to buildrevanced-patchesand optionally publishrevanced-patcherExample configuration:
<component name="ProjectRunConfigurationManager"> <configuration default="false" name="Run ReVanced CLI" type="JetRunConfigurationType"> <option name="MAIN_CLASS_NAME" value="app.revanced.cli.command.MainCommand.kt" /> <module name="revanced-cli.main" /> <option name="PROGRAM_PARAMETERS" value=" patch -b ../revanced-patches/build/libs/revanced-patches-<version>.jar -m ../revanced-integrations/app/build/outputs/apk/release/revanced-integrations-<version>.apk -o ../revanced.apk -d device-serial -r ../revanced-cache --options ../options.toml ../binaries/unpatched-input.apk" /> <method v="2"> <option name="RunConfigurationTask" enabled="true" run_configuration_name="revanced-patcher [publish]" run_configuration_type="GradleRunConfiguration" /> <option name="RunConfigurationTask" enabled="true" run_configuration_name="revanced-patches [build]" run_configuration_type="GradleRunConfiguration" /> <option name="Make" enabled="true" /> </method> </configuration> </component>Note
: The build file names of
revanced-patchesandrevanced-integrationschange. Do not forget to update them in the run configuration program arguments.
4. ⚙️ Setup Android Studio
- Open the
revanced-integrationsproject in Android Studio and ensure you are using the latest Android SDK. - Add a new default build configuration and confirm if it succeeds.
5. ⚠️ Troubleshoot your development environment
To confirm your development environment works as intended, set a breakpoint in any patch from the revanced-patches project in IntelliJ IDEA. Run the build configuration for revanced-cli and confirm that your IDE reaches and breaks at the breakpoint. Continue and let ReVanced CLI exit.
-
If ReVanced CLI output is unexpected, confirm if you supplied the correct program arguments by following 💻 ReVanced CLI.
-
If the breakpoint was not hit, confirm that you correctly added the necessary projects as modules to the
revanced-cliproject
❗ Afterword
A couple of things should be considered with the development environment for ReVanced:
-
Follow conventional commits
-
Pull new commits from remote to keep your branch up to date
-
Keep your Run/Debug configuration up to date. After pulling new commits, ensure you use the correct paths in your program argument. If you forget to do this, you might end up debugging for hours until realizing, you supply the wrong paths to ReVanced CLI
-
Use development branches and always branch off and PR to
devbranches -
To use the local
revanced-patcherproject in therevanced-cliandrevanced-patchesprojects, make sure you publish it to the local Maven repository with./gradlew publishand use the correct version in thebuild.gradle.ktsfile in therevanced-cliandrevanced-patchesprojects, otherwise, it will use the package from GitHub Packages