yashsingh1/xdaforums huggingface dataset:
[Android Software Development] Lanchon:
u have to review and edit all files, including the ones you deleted.

yes patched needs a manifest. see standard manifest merger docs in the android build system. to use dxp you need to understand how to use android libraries. apk libraries are similar to those.

no. the source project does all the needed apktool and dex2jat stuff. if you want to see cfr output to help you understand the code, you need to invoke it urself. cfr is not part of dexpatcher.
[Android Software Development] tanago:
https://github.com/tanago/camera_z3/blob/master/SemcCameraUI-xxhdpi/build.gradle

check this, I can't import this jar file by any means, compile fileTree/files/project ....

I need

import com.sonyericsson.cameraextension.*; from this jar

in

com/sonyericsson/android/camera/device/CameraDevice.java
[Android Software Development] Lanchon:
hi,

i dont understand what you mean.

where do these "com.sonyericsson.cameraextension.*" classes come from?

btw, using [MENTION=232767]dex[/MENTION]Edit(defaultAction = DexAction.IGNORE)" is dangerous! i would never use default IGNORE.

better define an explicit empty class constructor and mark it [MENTION=916460]dexi[/MENTION]gnore.

javac can output many class members that you don't expect but may be vital, and "defaultAction = DexAction.IGNORE" silently discards them.
[Android Software Development] Lanchon:
if you need to import a jar that is completely different from the apk you are modding, just drop the jar in this directory:

/SemcCameraUI-xxhdpi/libs

all jars there will be imported because of this line in your patched build gradle:

https://github.com/tanago/camera_z3/blob/master/SemcCameraUI-xxhdpi/build.gradle#L60

they will become part of the patch and end up being added to the patched apk because untagged classes are DexAdd by default.
[Android Software Development] Lanchon:
UPDATE:

new versions of DexPatcher-tool released!

v1.1.0

v1.1.1

v1.2.0-beta-1

many enhancements including multi-dex support.

enjoy!
[Android Software Development] zhaozihanzzh:
Support MultiDEX?You are awesome.Thank you.:good:
[Android Software Development] PerfectSlayer:
Nice to see some updates of the project!
[Android Software Development] Lanchon:
UPDATE:

DexPatcher-tool v1.2.0 is out!

EDIT:

you might also want to look at this:

https://github.com/Lanchon/haystack

enjoy!
[Android Software Development] zhaozihanzzh:
What's this? Disable signature checking?
[Android Software Development] Lanchon:
https://github.com/microg/android_packages_apps_GmsCore/wiki/Signature-Spoofing

also, signature spoofing is interesting for DexPatcher users for obvious reasons.
[Android Software Development] bigsupersquid:
hope you don't mind a cross-post?

the microg thread would probably be interested in haystack, so I'm pointing it out to 'em.
[Android Software Development] Lanchon:
thanks!
[Android Software Development] Lanchon:
UPDATE:

LICENSING CHANGE: patches no longer forcefully covered by the GPL.

********************************************************************
LICENSING NOTE: Recent versions of DexPatcher no longer require that
users bundle the DexPatcher annotations with every patch (although
continuing to do so has no ill effects). [COLOR="Red"][B]The DexPatcher licensing
terms no longer impose licensing restrictions on patches[/B][/COLOR], as long as
users refrain from bundling the DexPatcher annotations with them.
In particular, DexPatcher patches are no longer considered to be
derivative works of DexPatcher and thus are no longer automatically
covered by the GPL. Legals aside, the DexPatcher project urges you
not to use copyright laws to introduce artificial scarcity in the
world. Please give back to the community: share your work.
********************************************************************
[Android Software Development] Lanchon:
UPDATE:

new version of DexPatcher-gradle released!

supports all new features in DexPatcher-tool v1.2.0 including multi-dex support.

there's also a multi-dex sample now.

enjoy!
[Android Software Development] ShotSkydiver:
THANK YOU SO MUCH for this tool! I've been using it nonstop this week since I came across it and it's exactly what I was looking for for what I'm trying to do!! I just have one question that I can't figure out and it's really frustrating, so, I'm working on an apk from the play store that unfortunately has class obfuscation, so I have about 8000 .class files in the root of my classes.lib of the source apk, and the biggest issue is the fact that none of my project java files that are in various packages (99% of them) can actually see these package-less .class files, which is a huge limitation when trying to modify the source. Is there ANY way I can access these 8000 randomly-named class files within the project's java packages?
[Android Software Development] Lanchon:
UPDATE:

major overhaul to DexPatcher's Gradle plugins released!

v0.4.0 supports the latest tool versions and environments.

(including Android Plugin v1.5.0 to latest v2.2.2.)

take a look at the release notes here.

includes updated samples.

enjoy!
[Android Software Development] zhaozihanzzh:
Is it possible to use your awesome tool on Android ?
[Android Software Development] Lanchon:
thanks! :)

which tool? there are several here. do you mean the command lind patcher dexpatcher-tool? yes it is possible. check out these release notes https://github.com/DexPatcher/dexpatcher-tool/releases/tag/v1.2.0-beta2 where i benchmark performance running on both PC and android. i even have a prototype android mod that applies patches to framework and apks just-in-time, acting similarly to xposed. (but i don't have time to refine or publish that for now.)

btw, i haven't been able to run dexpatcher in recovery yet though, but it should be possible.
[Android Software Development] zhaozihanzzh:
Oh. So will you make a GUI for DexPatcher Tool?
[Android Software Development] Lanchon:
i have no plans. there is dexpatcher-live that patches just in time, as i told you, but i have no plans of publishing it for now. for now it works on marshmallow but not on nougat.
[Android Software Development] qu4gmire:
For users of microG, do Haystack/DexPatcher provide the means for seamless OTA updates, or would one have to go back through ADB like with Needle? Haystack seems infinitely more complicated than Needle to me (this is NOT a complaint, I'm just not a developer/programmer), so I'd only want to learn to use Haystack if it meant I wouldn't need to repatch through Needle after every update or use Xposed (which does allow for OTAs through Magisk, but I would prefer not to install it).
[Android Software Development] bigsupersquid:
Doubtful. I'm not aware of anything in the updating process that could walk framework patches forward into a fresh OS. It might even break incremental OTA functions.
[Android Software Development] Lanchon:
haystack is not dexpatcher, just something that uses dexpatcher. and no, it does not patch in-phone. it could, it would be easy to, but i dont really care much about haystack. it's just a demo. bottom line: these tools shouldn't exist. use a non-crippled OS (cyanogenmod was crippled in too many ways to count and i'm kinda glad it's gone). or use xposed.
[Android Software Development] NeoCo:
Thanks for share
[Android Software Development] qu4gmire:
Don't worry, I'm not that slow!

Thanks for the info. I'd love to have something like an Omnirom, but the only custom ROMs available for my device (honor 5x) appear to be CM/Lineage and their derivatives.
[Android Software Development] dk_zero-cool:
Demo or not, haystack works. Tried one of the other and they broke the ROM whereas dexpatcher did a fine job implementing it. I looked it over and it looks interesting. Your examples however left me with some questions though. They all add an application as source for the patches, but how do you set up a patch project for Android framework files and create patches like the ones used in haystack?
[Android Software Development] Lanchon:
well for haystack i did it manually. it's fairly simple: just javac the patch and dx its classes. you'll probably want to set up boot classpath for javac pointing to android runtime. the gradle plugins are geared to patch APKs. i believe that, with android being free software, patching binary android is kinda pointless. but i guess you could rename a framework jar to apk and have the gradle plugin process it successfully if you are lucky. tell me how it goes!
[Android Software Development] p32929:
Can anyone please make a video tutorial for this?

Thanks in advance...
[Android Software Development] poly.mathic:
Help

Hello, this is my first post on XDA. I am a newbie modder/dev and I was having some trouble getting this plugin running in Android Studio V 2.3.2 . My question is this; Can DexPatcher be run from within Android Studio as stated in the description. If so can someone lay out the steps to properly install and use it?

thanks.
[Android Software Development] naavbell:
anyone else having problems with android studio 2.3.3 and gradle 2.3.3
[Android Software Development] bxlr:
Yes, I had to downgrade to an old copy of 2.0 I had lying around. It is really hard to download the 2.1 version this plugin seems to require. Also seems to have trouble with apps compiled against sdk 23 or newer.
[Android Software Development] Lanchon:
hi guys, haven't noticed the posts.

dxp-tool has supported API 24 (Android 7.0) for a while, but i updated it 5 days ago to add API 25 (7.1).

as stated in this release note, dxp-gradle supports java 7 and java 8 android studio versions:

Supports the 'traditional' Java 7-based toolset:

Android Studio up to v2.1.3.

Groovy-based Android Plugin for Gradle v1.5.0 through v2.1.3.

Tested with Gradle v2.9 through v2.14.1. (But see the Android Plugin requirements.)

Supports the new Java 8-based toolset:

Android Studio from v2.2.0 on.

Java-based Android Plugin for Gradle from v2.2.0 on.

Adapts to Groovy/Java plugin differences via reflection.

Tested with Gradle v2.14.1.

these are tested versions of AS, including the SHA-1 hashes:

java 7:

http://tools.android.com/download/studio/builds/2-1-3

java 8:

http://tools.android.com/download/studio/builds/android-studio-2-2-stable

EDIT:

2.2.2 also works fine.

EDIT:

SEE 2ND POST BELOW.

i've got the linux zip both of these versions, but not the files for other platforms.

i never expected stupid google would delete them, but you can probably find them based on the hashes.

you can build magnet links too: https://en.wikipedia.org/wiki/Magnet_URI_scheme#Secure_Hash_Algorithm_1_.28SHA-1.29

> It is really hard to download the 2.1 version this plugin seems to require.

it doesn't. it works on 2.2.0 and on until... they broke stuff again, who knows when.

> Also seems to have trouble with apps compiled against sdk 23 or newer.

it shouldn't have trouble with API 23 (android 6.0)! API 23 still uses dex file format 035.

btw... if such a problem exists (doubtful?) and you don't report it via a github issue, how on earth am i supposed to know about it and fix it?

now, API 24 and on they use dex file format 037.

there's a big problem with 037: dexpatcher-tool supports it, but dex2jar seems to have been abandoned and chokes on 037. this is a HUGE problem for free android. the only replacement for dex2jar is enjarify, which handles 037 but doesn't translate annotations (and whatever they encode, including generic declarations).

so for the time being, you can't really process 037 apps (which work only on Nougat, so these are manufacturer/bloatware apps only). the hacky workaround is manually passing the dex file though dexpatcher to rewrite the version number to 035, then process using dex2jar. dex2jar will choke translating many methods, but dex2jar is only really used to translate declarations, so you can used the "no code" option to generate only empty methods, which seems to work just fine.

because there is no dex2jar and no xposed for android 7, i consider android 6 the last acceptably free android, and i wont upgrade. finding hardware to run android 6 is tricky: i'm using oneplus 3T, which launched with Nougat but has backports of CM13, but the OP3T has been discontinued.

so... reports?

API 23 apks that don't work?

AS version confirmed NOT to work?

is anybody interested in the AS versions for linux that i have?

thanks!
[Android Software Development] Lanchon:
anybody tried or has AS 2.2.3?

http://tools.android.com/download/studio/builds/android-studio-2-2-3

btw guys, an important thing to note is that dxp-gradle does not care about the version of AS at all.

what it does care about is the Android Plugin for Gradle version.

the idea is that you should be able to just point to the right plugin:

https://github.com/DexPatcher/dexpatcher-gradle-samples/blob/v0.4.2/patched-app/build.gradle#L10

from the build file and it should work with any recent AS... in theory.

have you tried this?

thanks!
[Android Software Development] Lanchon:
indeed, DexPatcher works perfectly well in Android Studio 2.3.3.

EDIT: works fine in Android Studio 2.4 Preview 7.

EDIT: doesn't work in Android Studio 3.0 Canary 8 (at least without upgrading gradle).

as stated above, you just have to NOT UPGRADE the project's android plugin and gradle wrapper, and that's all.

just check out the samples and don't modify them, and they will build ok.

EDIT:

be sure to pull the latest changes from the https://github.com/DexPatcher/dexpatcher-gradle-tools repo to your local machine to bring in the latest versions of the tools used by the dexpatcher-gradle plugins.
[Android Software Development] Lanchon:
given that google deletes old Android Studio versions, i created an

Android Studio download mirror
[Android Software Development] esun:
Is it possible to add static fields to classes? I don't seem to be able to do it.

Edit: Also, other than my static field problem everything works well with Android Studio 3.0 Canary 8. Haven't upgraded Gradle.
[Android Software Development] Lanchon:
tested:

current DXP-gradle supports Android Plugin for Gradle v1.5.0 through v2.2.3.

it also works with gradle v3.3 (with deprecation warnings).
[Android Software Development] esun:
Many thanks to you! This is an awesome tool and your response is very clear.

Edit: Seems to work with AS C9 too
[Android Software Development] esun:
So I'm trying to remove kotlin from the source build to be able to use kotlin in my patch-app.

Based in the dexpatcher-tool source I came upp with this code

@DexRemove(recursive = true)
package kotlin;

import lanchon.dexpatcher.annotation.DexRemove;

And places it in src/main/java/kotlin/package-info.java since annotations does not seem to be able to be applied outside of package-info.java. Now, the compiler still warns about kotlin clashing:

Error:Execution failed for task ':patched:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK kotlin/reflect/reflect.kotlin_builtins
File1: /Applications/Android Studio 3.0 Preview.app/Contents/gradle/m2repository/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.jar
File2: patched/build/intermediates/exploded-aar/PatchedProject/source/unspecified/jars/classes.jar

Am I doing something wrong? I read it from the mini-faq here

https://github.com/DexPatcher/dexpatcher-tool/blob/master/test/patch/src/main/java/test/Main.java
[Android Software Development] Lanchon:
ok, first the obvious question: why do you want to remove the lib then add it back to use the lib? why can't you use the lib that is already there in the source app?

second: it's best if you use this incantation instead:

https://github.com/DexPatcher/dexpa.../patch/src/main/java/test/Main.java#L439-L443

because the lib you are adding could potentially have it's own package annotations... i really don't know, just warning you.

third: the problem is java resources. java resources are files in the java jar that are not classes (such as "*.properties" files). the file in question is "kotlin/reflect/reflect.kotlin_builtins". contrary to *.class files, these files are not "dexed" into the dex file(s). this means that, although DXP can remove the lib code, it can't really remove its resources because they don't exist in the dex file.

3 solutions:

a) android gradle plugin is doing the java resources merging, not me. study the android build system to know how to make it overwrite the old file with the new one. resource merger (for android resources) is very complex and configurable: you can define actions to modify resources in xml code. this resource merging exists since android stared to allow android libraries (*.aar files), and it is leveraged by DXP to merge app and patch resources. but this is a java resource, not android! i don't know how configurable the android build system is in this regard, you'll have to google and learn.

b) manually remove the files form the source APK. it's a nasty hack but it's easy and works fine.

c) manually remove the files from the lib you are adding (not recommended because the lib files and the code will be version-mismatched).

but most of all, question 1, why do you need to do this?

thanks
[Android Software Development] esun:
I want to use kotlin and I'm not able to import the standard kotlin commands from it's java-equalent. The problem arouse when the targeted app started to use kotlin at which point the clash happened. If I'd try to compile the kotlin code without the dependency it the patch-app then kotlin standard functions like listOf won't work.

I thought replacing the entire lib in the source app would be the simplest solution.
[Android Software Development] Lanchon:
i see. not familiar with kotlin and how to configure its tooling. the situation is maybe similar to having a java library (or maybe an android library (*.aar) too) made with kotlin and trying to use it from a client written in kotlin. as i said before, the cleanest solution would probably a). thanks!
[Android Software Development] esun:
After some testing I've come to the conclusion that the library I want to replace (kotlin) is obfuscated with proguard so replacing it isn't straight forward at all. Replacing it makes the source app calling non-existing methods. It seems I would nee to rename the entire kotlin dep I'd adding (haha :eek:) or just write it in java as usual.

Thanks for your suggestions!
[Android Software Development] Lanchon:
ohhh so thaaaaat's why you couldnt use the existing lib lol.

there's a gradle "shadow" plugin that does exactly that. still i guess java would be easier. sorry!
[Android Software Development] Lanchon:
hey, great news!!! dex2jar's author pxb1988 is back at work and is adding support for dex versions 037 and 038!

while he's at it, i made unofficial releases of dex2jar supporting Android 7.x and 8.x for those of us who can't wait:

https://github.com/Lanchon/dex2jar/releases

all credit belongs to the project team, of course.

EDIT:

i've pushed the the 8.x version to the dexpatcher-gradle-tools repo.
[Android Software Development] Lanchon:
hey, I updated all components of DexPatcher today.

now supports Android 7.0 and 7.1 apks.
[Android Software Development] apc:
I'm trying to get the sample working as this approach seems very interesting for .apk patching.

After cloning the tools and sample repos and setting the dexpatch.dir property, I am stuck with the following error from the Gradle build:

FAILURE: Build failed with an exception.

* What went wrong:
Failed to notify task execution listener.
> com.android.build.gradle.internal.tasks.PrepareLibraryTask.getExplodedDir()Ljava/io/File;
> com.android.build.gradle.internal.tasks.PrepareLibraryTask.getExplodedDir()Ljava/io/File;
> com.android.build.gradle.internal.tasks.PrepareLibraryTask.getExplodedDir()Ljava/io/File;
> com.android.build.gradle.internal.tasks.PrepareLibraryTask.getExplodedDir()Ljava/io/File;

Any idea what this is related to?

I have Android Studio 2.3.3 and Gradle 3.3
[Android Software Development] Lanchon:
hi!

this probably happens because you are using android gradle plugin v2.3.x.

as stated in the release notes, dexpatcher-gradle plugin works with android plugin up to v2.2.x:

https://github.com/DexPatcher/dexpatcher-gradle/releases

make sure you read all previous release notes down to v0.4.0.

the samples now use android plugin v2.2.3, the latest supported version:

https://github.com/DexPatcher/dexpa...b23a9feaaefb7618/patched-app/build.gradle#L10

and gradle v2.14.1.

so basically it looks like your samples don't work because you modified them :)

why don't you clone the samples again and try them as they are?

there is no reason to use gradle v3.3. the samples got their own adequate gradle wrapper that you don't need to upgrade.

also, make sure you have the latest version of the dxp-gradle-tools repo.

works now?
[Android Software Development] apc:
You are spot on, re-cloned the samples and suppressed the urge to click on the "Update Gradle" button and now it works :o.

All I have to figure out now is where to start with my patching... :p

Thanks again, really nice work!
[Android Software Development] Lanchon:
STATUS, FYI....

DXP-gradle support of android plugin 2.3.x is blocked by this bug:

https://issuetracker.google.com/issues/64622383

DXP-tool support of android O is blocked by smali not supporting dex version 038.

thanks!
[Android Software Development] Lanchon:
UPDATE: DexPatcher-tool v1.3.0 is out!

with the new DexWrap tag that you'll love, check it out...

https://github.com/DexPatcher/dexpatcher-tool/releases/tag/v1.3.0
[Android Software Development] Lanchon:
DexPatcher Tool Roadplan

I've added a roadmap for the tool here:

https://github.com/DexPatcher/dexpatcher-tool/issues/14

there is no guarantee whatsoever that the changes described there will ever be implemented.
[Android Software Development] apc:
I really loves this tool, especially with the Android Studio integration.

I successfully created a few patched versions of applications :). Now to the next step - how do you recommend to deliver the patches to updated source apks?
[Android Software Development] Lanchon:
thanks!

i'm not sure i understand the question...

do you want to distribute patches to other people?

or do you want to port patches to a newer version of the app?

if you want to port patches, assuming that the app is not obfuscated, i just simple replace the apk file and rebuild. between the java compiler and dexpatcher, they should catch most errors. but not all... some might crop up at runtime unfortunately. this will be fixed when i implement @ DexCheck, see the roadmap in my previous message for details.
[Android Software Development] :
Hi!

Is it possible to configure gradle plugin for decoding apk so that apktool to install frameworks before being decoding? The problem that I trying to decode apk file that depends on vendor's framework file(lge-res.apk). How can I deal with it using AndroidStudio?