Jintonic is the first Android library fully based on AOP (Aspect-Oriented Programming).
It allows you to hook and weave behaviors at build time directly into your .class files through Gradle plugins.
- Easy-to-use annotations for checks and safety:
@RequireInternet(mustThrow = true)
@MinBattery(minOrEqualValue = 60)
fun kotlinApiCall() = "Kotlin Api call done successfully"
@Timed
fun hello() = runBlocking {
delay(5000)
}
@RequireVpn
fun vpnMethod() {
LOG("Executed Vpn Method")
}
@WithRoot(forRoot = false)
fun rootMethod() {
LOG("Inside root method")
}To start using Jintonic in your Android project, simply include the Gradle plugin and the core dependency as shown below.
Add the following to your module-level build.gradle.kts file:
// MAKE SURE TO ADD JITPACK AND GRADLE PLUGIN REPO INTO SETTINGS.gradle //
plugins {
id("io.github.daniele-NA.gradle") version "x.z.y"
}
android {
//........
}
dependencies {
implementation("com.github.daniele-NA:jintonic:vX:Y:Z") // DO NOT OMIT THE 'v' BEFORE VERSION
}- ✅ Hook and intercept methods with zero boilerplate
- ⚡ Build-time weaving for optimized performance
- 🔧 Full control over cross-cutting concerns like logging, validation, and execution policies
The current version of the Jintonic Gradle plugin performs AspectJ weaving on your Java/Kotlin classes.
However, it does not yet properly handle native methods (e.g., methods implemented in C/C++ via JNI). Attempting to weave aspects into classes with native methods may cause build errors or unexpected behavior.
A recommended enhancement is to add a feature to exclude specific packages or classes from the weaving process.
This can prevent common errors caused by third-party libraries (such as com.google.* or com.firebase.*) and allows safer incremental adoption of AspectJ weaving.
Example of a possible configuration once implemented (TODO YET) :
jintonic {
excludedPackages = listOf("com/google", "com/firebase")
}| Annotation | Info | Manifest / Permissions Required |
|---|---|---|
| MinBattery | Ensures that the current battery level is greater than or equal to minOrEqualValue. Throws exception if not. Range 0-100. |
NO PERMISSIONS REQUIRED |
| RequireInternet | Checks if there is an active Internet connection before executing the method.Otherwise throws exception. | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.INTERNET"/> |
| RequireVpn | Throws an exception if a VPN is not active during method execution. | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> |
| Timed | Logs the execution time of the method. Does not modify method execution. | NO PERMISSIONS REQUIRED |
| WithRoot | Checks if the device is rooted. Executes method based on forRoot parameter. |
<queries> <package android:name="com.noshufou.android.su" /> <package android:name="com.thirdparty.superuser" /> <package android:name="eu.chainfire.supersu" /> <package android:name="com.koushikdutta.superuser" /> <package android:name="com.zachspong.temprootremovejb" /> <package android:name="com.ramdroid.appquarantine" /> </queries> |
| SecureWindow | Allows blocking screenshots and screen recording for the annotated Activity class. | NO PERMISSIONS REQUIRED |
Contributions are welcome!
# Clone the repo
git clone https://github.com/daniele-NA/jintonic
cd jintonic
# Build and test locally
./gradlew build
./gradlew test- Open issues for bugs or feature requests
- Fork the repo, make your changes, and submit a PR
- Follow the existing coding style and keep commits clean and descriptive
This project is open source under the MIT license.
See the LICENSE file for details.
