176 lines
6.7 KiB
Groovy
176 lines
6.7 KiB
Groovy
// DexPatcher Patched Application plugin:
|
|
|
|
apply plugin: 'com.github.lanchon.dexpatcher.patched-application'
|
|
|
|
// The DexPatcher Patched Application plugin produces a modified Android application by
|
|
// applying changes to code, manifest and resources of a source application provided as
|
|
// an Android APK or a DexPatcher APK library.
|
|
|
|
dependencies {
|
|
// The source application is defined as a Gradle dependency.
|
|
|
|
// It is defined either as an Android APK dependency:
|
|
sourceApk fileTree(dir: 'apk', include: ['*.apk', '*.jar', '*.zip'])
|
|
|
|
// Or as a DexPatcher APK library dependency:
|
|
//sourceApkLibrary fileTree(dir: 'apklib', include: ['*.apklib'])
|
|
|
|
// The contents of the 'apk' and 'apklib' project subdirectories are included in
|
|
// these configurations by default. Exactly one source application dependency
|
|
// must be available to the build.
|
|
}
|
|
|
|
// General Plugin Configuration
|
|
dexpatcherConfig {
|
|
// Plugin-Specific Configuration
|
|
patchedApplication {
|
|
// Display package and version information of the source app on every build.
|
|
// Note that this info can also be queried by invoking the 'sourceAppInfo' task.
|
|
// Defaults to false.
|
|
printAppInfo = true;
|
|
|
|
// Enable import of Java symbols from the source app. Defaults to true.
|
|
importSymbols = true;
|
|
|
|
// Disable detection of invalid resources and attempt to process them normally.
|
|
// Defaults to false.
|
|
disableResourceValidation = true
|
|
|
|
// Build the patched app using a custom AAPT2 binary bundled with the version of
|
|
// Apktool currently in use. These AAPT2 binaries are modified to allow rebuilding
|
|
// of slightly out-of-spec apps, such as apps that contain invalid resources.
|
|
// Defaults to false.
|
|
useAapt2BundledWithApktool = true
|
|
|
|
// Speed up debug builds by enabling multi-threaded multi-dex processing for them,
|
|
// but only if multi-dex mode is already enabled for them. Defaults to true.
|
|
//multiDexThreadedForMultiDexDebugBuilds = true
|
|
|
|
// Speed up debug builds by enabling multi-threaded multi-dex processing for them,
|
|
// even if multi-dex mode is not already enabled for them. Note that apps patched
|
|
// in multi-dex mode are only compatible with devices running Android 5.0 (API 21)
|
|
// and later. Defaults to false.
|
|
//multiDexThreadedForAllDebugBuilds = true
|
|
|
|
//dexpatcherAnnotationClasspath.setFrom project.files(...)
|
|
}
|
|
|
|
// Apktool Task Defaults
|
|
apktool {
|
|
// Use a framework provided in a project subdirectory:
|
|
//frameworkInDir = layout.projectDirectory.dir('framework')
|
|
//frameworkTag = 'tag'
|
|
|
|
//apiLevel = 14
|
|
//keepBrokenResources = true
|
|
//stripDebugInfo = true
|
|
|
|
//classpath.setFrom project.files(...)
|
|
//extraArgs.addAll ...
|
|
}
|
|
|
|
// Dex2jar Task Defaults
|
|
dex2jar {
|
|
//translateCode = false
|
|
//translateDebugInfo = true
|
|
//optimizeSynchronized = true
|
|
//reuseRegisters = true
|
|
|
|
//classpath.setFrom project.files(...)
|
|
//extraArgs.addAll ...
|
|
}
|
|
|
|
// DexPatcher Task Defaults
|
|
dexpatcher {
|
|
// The Android api level of dex files. The api level is auto-detected by DexPatcher
|
|
// v1.2.0 and later, so this setting is no longer needed for normal operation.
|
|
//apiLevel = 14
|
|
|
|
// DexPatcher multi-dex patching mode is automatically enabled if multi-dex is
|
|
// enabled in the Android build system. However, you can also enable multi-dex
|
|
// patching manually:
|
|
//multiDex = true
|
|
// Note that multi-dex need not be enabled in the Android build system unless the
|
|
// patch dex itself is large and requires it. The dex sizes of the source app and
|
|
// the patched app are not relevant.
|
|
|
|
// Enable multi-threaded multi-dex processing, if multi-dex mode is already enabled.
|
|
// Multi-threaded processing is faster but produces more dex files than the bare
|
|
// minimum required by the contents of the patched app. This is recommended for
|
|
// debug builds but not for releases.
|
|
//multiDexThreaded = true
|
|
|
|
// Set the number of multi-dex processing threads, if multi-threaded multi-dex mode
|
|
// is already enabled. Defaults to the number of available processors up to 4.
|
|
//multiDexJobs = 8
|
|
|
|
// The maximum number of items in the pools of the output dex files. This limits,
|
|
// for example, the number of method references in each dex file. Defaults to 65536.
|
|
//maxDexPoolSize = 65536
|
|
|
|
// The package name of the used DexPatcher annotations. Useful to handle rogue apps
|
|
// that want to disallow patching by intentionally clashing with standard DexPatcher
|
|
// annotation names. Defaults to 'lanchon.dexpatcher.annotation'.
|
|
//annotationPackage = 'lanchon.dexpatcher.annotation'
|
|
|
|
// Enable implicit ignore of trivial default constructors. Defaults to true.
|
|
//constructorAutoIgnore = true
|
|
|
|
// The verbosity of the DexPatcher tool. One of QUIET, NORMAL, VERBOSE or DEBUG.
|
|
// Defaults to NORMAL, but VERBOSE is recommended.
|
|
verbosity = VERBOSE
|
|
|
|
// Enable logging of relative paths of source files instead of just their filename.
|
|
//logSourcePath = true
|
|
|
|
// Enable logging of paths of source files prepending the specified root.
|
|
//logSourcePathRoot = file('src/main/java')
|
|
|
|
// Enable logging of timing statistics.
|
|
//logStats = true
|
|
|
|
//classpath.setFrom project.files(...)
|
|
//extraArgs.addAll ...
|
|
}
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion 29
|
|
//buildToolsVersion '28.0.3'
|
|
|
|
defaultConfig {
|
|
// The 'package' attribute in the patched app manifest must be different from the
|
|
// source app ID to support class generation (R and BuildConfig), but here you can
|
|
// override the exported patched app ID to match the source.
|
|
applicationId 'com.discord'
|
|
|
|
// You must set these fields to match or be compatible with the corresponding data
|
|
// of the source app. (Data is displayed when the source apk library is built.)
|
|
minSdkVersion 21
|
|
targetSdkVersion 29
|
|
versionCode 1368
|
|
versionName '54.0'
|
|
|
|
}
|
|
|
|
lintOptions {
|
|
disableLintTasks true
|
|
//checkReleaseBuilds false
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
//implementation "androidx.exifinterface:exifinterface:1.3.2"
|
|
//implementation 'androidx.appcompat:appcompat:1.2.0'
|
|
//provided "com.google.android.material:material:1.2.1"
|
|
|
|
|
|
}
|
|
|
|
void disableLintTasks(boolean disableTasks) {
|
|
if (disableTasks) {
|
|
tasks.withType(com.android.build.gradle.tasks.LintBaseTask).configureEach {
|
|
enabled = false
|
|
}
|
|
}
|
|
}
|