Skip to content

Notedop/atag_one_patch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧩 Overview - Rebuilding and Patching the Atag One APK

This document describes the step-by-step process for extracting, modifying, and rebuilding the Atag One Android APK, including replacing specific classes (UdpReceive, UdpSwitcher, and GetSSID).

This guide documents the process of modifying and rebuilding the Atag One Android app to restore compatibility with modern Android versions. The official Atag One app no longer functions correctly on recent Android releases due to changes in network permissions and stricter background operation policies. Specifically, the app fails to properly receive UDP multicast packets — which are essential for device discovery and communication — because it does not acquire the necessary Wi-Fi multicast lock or release it properly when no longer needed.

To resolve this, we decompile the APK, modify several internal classes (UdpReceive, UdpSwitcher, and GetSSID), and reinsert them into the original app. The purpose of this project is not to rebuild or run the app from scratch, but rather to use a minimal Android project setup with Cordova as a compile environment to generate updated .class files. These are then converted to smali code and used to replace the original ones in the APK before repackaging and signing it for installation.

The workflow includes:

  • Apktool for decompiling and rebuilding the APK.
  • Jadx-GUI to inspect the original Java code.
  • Android Studio / D8 / Baksmali to recompile modified classes to .dex and smali.
  • ADB to extract, uninstall, and reinstall the app on a device.
  • Apksigner to sign the modified APK for deployment.

This process provides a way to patch and restore functionality to legacy apps that are no longer maintained, without access to their original source code.


0️⃣ Download the Original APK from Your Device

Before modifying the app, pull the currently installed version from your device using ADB. You may want to upgrade to the latest version from the Play Store first.

  1. Find the package path:

    adb shell pm path io.cordova.AtagUser

    Example output:

    package:/data/app/~~v8RqpqFv9gxt/io.cordova.AtagUser-7v3r7u7g7q7g==/base.apk
    
  2. Pull the APK to your PC:

    adb pull /data/app/~~v8RqpqFv9gxt/io.cordova.AtagUser-7v3r7u7g7q7g==/base.apk atag-one.apk

    You now have atag-one.apk locally for decompiling.


1️⃣ Uninstall the Existing App

Remove the currently installed version from your Android device:

adb uninstall io.cordova.AtagUser

2️⃣ Decompile the Original APK

Use Apktool to extract resources, Smali code, and the manifest:

apktool d atag-one.apk -o atag-one-src

3️⃣ Locate Original Class Files

Use JADX-GUI to browse the original APK and locate the following Java classes:

  • io.cordova.AtagUser.UdpReceive
  • io.cordova.AtagUser.UdpSwitcher
  • io.cordova.AtagUser.GetSSID

These are the classes you’ll modify and rebuild.

NOTE: included in current project


4️⃣ Create a Temporary Android Project

NOTE: This is the current repository. Not needed if you just do a check out. Adjusted classes are included inside this project.

  1. Create a new Android application project.

  2. Add Cordova as a transitive dependency using the compileOnly directive in your build.gradle:

    dependencies {
        compileOnly "org.apache.cordova:framework:13.0.0"
    }

    This ensures Cordova APIs are available for compilation but are not bundled into your final build (matching the structure of the original APK).

  3. Add your three target classes (UdpReceive, UdpSwitcher, GetSSID) to the project.

  4. Make your desired modifications.


5️⃣ Compile and Collect the .class Files

Build the Android project and copy all generated .class files (including inner classes) to a working folder, e.g. test/. The output .class files can be found in:

[projectdirectory]\app\build\intermediates\javac\debug\compileDebugJavaWithJavac\classes\io\cordova\AtagUser

Example structure:

test/
 ├── GetSSID.class
 ├── UdpReceive.class
 ├── UdpReceive$1.class
 ├── UdpReceive$2.class
 ├── UdpReceive$3.class
 ├── UdpSwitcher.class
 ├── UdpSwitcher$1.class
 └── UdpSwitcher$2.class

6️⃣ Convert Classes to Smali

Convert the compiled .class files to .dex format using d8, then disassemble the .dex file to Smali using baksmali:

d8 test/GetSSID.class test/UdpReceive$1.class test/UdpReceive.class test/UdpReceive$2.class test/UdpReceive$3.class test/UdpSwitcher.class test/UdpSwitcher$1.class test/UdpSwitcher$2.class --output test/
java -jar baksmali-3.0.9-fat-release.jar disassemble test/classes.dex -o smali_out/

7️⃣ Replace Smali Files

Copy the generated Smali files from:

smali_out/io/cordova/AtagUser/

into the corresponding folder inside your decompiled APK source:

atag-one-src/smali/io/cordova/AtagUser/

Overwrite the existing ones.


8️⃣ Update Permissions in AndroidManifest.xml

If your modified classes require new permissions (e.g. network or Wi-Fi access), add them under the <manifest> section in:

atag-one-src/AndroidManifest.xml

Example:

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />

9️⃣ Rebuild the APK

Recompile your project back into an installable APK:

apktool b atag-one-src -o atag-one-multicast.apk

🔟 Sign the APK

Use Android’s apksigner to sign your rebuilt APK (using the debug keystore in this example):

"apksigner sign --ks "%USERPROFILE%\.android\debug.keystore" ^
  --ks-key-alias androiddebugkey ^
  --ks-pass pass:android ^
  --key-pass pass:android ^
  --out atag-one-signed.apk ^
  atag-one-multicast.apk

1️⃣1️⃣ Install the Patched APK

Deploy it to your connected Android device:

adb install -r atag-one-signed.apk

✅ Summary of Key Tools

Tool Purpose Download Link
Apktool Decompile and rebuild APKs https://github.com/iBotPeaches/Apktool/releases
JADX-GUI View Java source and class hierarchy https://github.com/skylot/jadx/releases
d8 Converts .class files to .dex Part of Android SDK Build Tools (in build-tools/<version>/d8.bat)
baksmali Disassembles .dex into Smali https://github.com/JesusFreke/smali/releases
apksigner Signs APKs for installation Part of Android SDK Build Tools
adb Install/uninstall and debug on devices https://developer.android.com/tools/releases/platform-tools

🧠 Notes

  • Always uninstall the existing app before reinstalling a modified APK to avoid signature conflicts.
  • Backup your atag-one-src folder before replacing any Smali files.
  • compileOnly ensures dependencies like Cordova are available at compile-time but not packaged in the final APK.

🎉 Final Result:
You now have a rebuilt, signed, and installed atag-one-signed.apk with your modified Cordova plugin classes successfully integrated.

Known issues

  • Repackaging the APK currently causes some issues with the UI of the app. For example, the UI elements seem slightly larget than usual.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published