yashsingh1/xdaforums huggingface dataset:
[Android Software Development] Lanchon:
UPDATE: DexPatcher-gradle v1.0.0 is out, finally!

also, the 'patched-dex' sample has been heavily updated to match.

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

https://github.com/DexPatcher/dexpatcher-gradle-samples/blob/master/patched-dex/build.gradle
[Android Software Development] ShlCar347:
Can anyone please link me to Linux sdk having platform-tools?
[Android Software Development] CosmicDan:
Howdy @Lanchon - hope everything is well and that 2018 has been a great year for you so far!

I recently got a new device, a Xiaomi Mi A1, an Android One. I inspected the Oreo update and found something interesting... the ROM looks like it's odexed (or "oated"), but all the framework/app jars/apks have classes.dex still contained within them. So it's not that it'd "odexed" per se, but more "pre-optimized". Do you know if this is the standard way of Oreo firmware these days? I wonder, if I patched classes.dex in the framwork as-is, would the system be clever enough to regenerate the odex/oat cache.... will have to try that out!

Hope DexPatcher can be updated for Oreo support soon! I'm excited to continue work on my modding tool, since I've completely turned off the heavyweighted custom ROM scene these days (yeah they add a lot of cool things, but most of it I don't need and often basic functionality is broken or less effective - so I prefer to mod stock ROM's with only the changes I want - but I digress). I wanted to start by porting or re-implementing some of my favorite MIUI features into AOSP-generic patches :D

Regardless, I still continue to use your gradle plugins for writing stand-alone java code that I can compile into smali, though. Thanks once again for all the work you've put into this.
[Android Software Development] Lanchon:
hi. i heard of android go, i flavor of android for low end devices. i heard it pre-compiles only often used code. this may be the reason why there are those dex files there. the oat files might actually not have compiled methods in them, and the VM might rely mostly on JIT compiles, not AOT. i dont have any idea how oreo works, or any ART by the way. dex is a "standard", ART is an implementation detail.

dxp wont get updated to oreo because JF is not updating dexlib2 (part of smali) on which dxp is based. smali seems to be abandonware now (same goes for dex2jar, btw), which is very bad because important software the likes of soot depend on it.

also i reported bugs in the newer android build systems. android team responded they confirm them but wont fix them. they are concentrating on a rewrite of the gradle plugins (version 3) so they wont be fixing bugs for 2.x. this, for a platform the importance of android is plain unacceptable. i'm not at all committed on rewriting dxp-gradle for android gradle 3.x, so oreo in general looks bad.

i dont really care because dxp is geared to patch 3rd party apps, and it will be a long time before oreo-only apps are published. i wish the android community would fork itself from google's android once and for all, instead of embracing google's ever poorer direction of the OS and inclusion of ever more anti features in the name of "upgrades".
[Android Software Development] edotassi:
Hi! I'm using your tool, it's awesome! -> https ://github.com/edotassi/AmazfitApp
[Android Software Development] Lanchon:
hey, glad you like it, thanks for the msg :)
[Android Software Development] edotassi:
[MENTION=4141005]Lanchon[/MENTION] no chance to bring dexpatcher to gradle 3?

I need to use aapt2

thanks!
[Android Software Development] Lanchon:
the dxp gradle plugin is compatible with gradle 3!

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

do you mean the android gradle plugin v3?

google doesn't care at all for projects like dxp: they break everything from version to version, and they also refuse to fix bugs you report on older or even current versions of their plugin stating that they are working on a rewrite. so basically they give zero support to anyone outside their business plan. they do not behave like free software producers and they do not care for their users.

for example, i reported a regression in android gradle plugin 2.3.x over 2.2.x. they repro it but refused to fix saying they were concentrating on v3 (which is a complete rewrite and thus a different product that happens to sport the same name). so v2 is abandonware; zero support. (btw, this is why the dxp gradle plugin is not compatible with android gradle plugin v2.3.x.)

i don't know if i want to invest the time to support yet another version of the android gradle plugin, v3. help me find reasons to do it. why do you need v3? what requires use of v3 and what features it adds over v2? what versions of android does it target?

thanks!
[Android Software Development] edotassi:
I'm patching the application of the Amazfit Pace.

From the latest version, I think they have updated the android gradle plugin and started using resource names with the '$' character.

With the 2.2.3 plugin the resource names with the character '$' are not accepted

I think with version 3 it should work

do you have any idea?

Thanks!
[Android Software Development] Lanchon:
thanks!

> I think with version 3 it should work

ok but that's not a strong enough incentive to dedicate many many hours to porting to v3!

if you want: take the apk library (source.apk.aar) file produced by your 'source' project and import it as any other android library into a regular android v2.x project (without any dxp plugin). it should fail on the '$...' resources. then import it into a regular v3 project. does it fail now, and how?

thank you again
[Android Software Development] edotassi:
is it complex to port to v3?

today i will try your advice, thanks!
[Android Software Development] edotassi:
[MENTION=4141005]Lanchon[/MENTION] i tried your advice and i get same error:

/Users/xxx/.gradle/caches/transforms-1/files-1.1/Amazfit 2.4.0.DEV.apk.aar/f8cc851473dee60bba699d0e55e5a94d/res/drawable-v21/$avd_show_password__2.xml: Error: '$' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore

with this configuration:

gradle 4.4

dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
buildToolsVersion '27.0.3'
compileSdkVersion 26

so it's not a problem of gradle ...

but how is it possible that there is a resource with the '$' inside the apk?

thanks!
[Android Software Development] Lanchon:
get the latest version of Apktool and do an APK disassemble/build roundtrip (you can avoid baksmaling/smaling the code, we just want the resources). see if apktool chokes while rebuilding... does it? the expert in android resources is the guy behind apktool. ask on apktool github or xda why does (or doesnt) it build resource files starting with $.

one reason for the unorthodox filename could be APK obfuscation. (is the app obfuscated?) i can imagine a commercial obfuscator running its own patched version of AAPT2, bending the rules for whatever ART and android framework don't check at runtime. and i can also imagine Apktool sporting a similarly patched AAPT2.

i was already looking into android gradle plugin v3 over this issue. please ask around and tell me what's going on.

thanks!
[Android Software Development] Lanchon:
[MENTION=6723547]edotassi[/MENTION],

please see: https://xdaforums.com/showthread.php?p=76523366
[Android Software Development] edotassi:
Thanks for the support, I opened an issue: https://github.com/iBotPeaches/Apktool/issues/1796
[Android Software Development] edotassi:
Hello [MENTION=4141005]Lanchon[/MENTION],

I made some progress...

I have decompiled the apk and renamed the resources with the character '$', now gradle goes ahead, but stops with this error:

:patched:generateDebugResValues UP-TO-DATE
:patched:generateDebugResources
:patched:mergeDebugResources
:patched:processDebugResources
/Users/edoardotassinari/Source/AmazfitMod/patched/build/intermediates/res/merged/debug/values/dexpatcher-public.xml: error: uncompiled XML file passed as argument. Must be compiled first into .flat file..
error: failed parsing overlays.

:patched:processDebugResources FAILED

I checked the other files in the 'patched/build/intermediates/res/merged/debug' folder and they are all with the '.flat' extension in binary format (I think).

I think this happens due to the fact that I have enabled aapt2 in the gradle.properties file, but if I do not enable aapt2 I have other errors.

I think the solution is to convert the dexpatcher-public.xml file to .flat format

what do you think about it?

Thanks!
[Android Software Development] Lanchon:
there is/was a bug in the android plugin (it might have been in manigest merger, i dont remember) that made it unable to process the public.xml file. so i implemented an ugly workaround in my plugin, bypassing meger for this file and feeding it directly to the packaging step. if now aapt2 needs preprocessing these files, this bypaas might explain the failure. why do you need aapt2? if you share the complete project somewhere to repro by simple "./gradlew build" (gitlab lets u do private repos, im lanchon there), then i might find some time to look at it.

the issue might be solved just by dissabling the workaround. i dont know if android plugin stopped needing it and when, but it was needed before android plugin v1.5 for sure.
[Android Software Development] edotassi:
[MENTION=4141005]Lanchon[/MENTION] project is open here: https://github.com/edotassi/AmazMod

Now I'm away from notebook, tomorrow I will upload source apk

Thanks!
[Android Software Development] Lanchon:
open is much better! i think your app is here: https://github.com/iBotPeaches/Apktool/issues/1796
[Android Software Development] edotassi:
yes!

i have attached an apk without resources with '$' character
[Android Software Development] edotassi:
[MENTION=4141005]Lanchon[/MENTION] technically it would be enough to put the dexpatcher-public.xml file before the resources are processed

It might work?
[Android Software Development] juanse254:
This might sound stupid, but could you extract the dex from one app and then using this dex to replace the dex from another app? will the app run after this?
[Android Software Development] CosmicDan:
The dex *is* the app. It's all the code.

What you're asking is like asking if you can replace the EXE's and DLL's from one Windows program and put them in another. What's the point of that?
[Android Software Development] juanse254:
Well to sum up, there is an exploit that can update system apps but in order to update the system apps the manifest must remain the same. Indeed the classes.dex is the program itself but if we could replace the classes.dex from the default amazon fire stick launcher with a custom launcher(which already exists) then we could have an android tv launcher without the need to root. Also we could remove the bloatware in higher versions of fire tv.

For more info:

https://xdaforums.com/showpost.php?p=76317207&postcount=2
[Android Software Development] CosmicDan:
That has nothing to do with DexPatcher at all.
[Android Software Development] juanse254:
It does, if DexPatcher is capable of extracting and showing the source code/packages of the main program and the "repacked" program we could use dexpatcher to extract replace and repatch the original packages, nonetheless is just a question not that i used DexPatcher before thats why am asking.
[Android Software Development] CosmicDan:
DexPatcher is a tool to patch existing apps with a Java IDE instead of smali hacking.

Yes, it could be used to modify apps. However you want. But your use case is beyond DexPatcher.
[Android Software Development] juanse254:
Moreover, after thinking a bit about it we could modify apps such as in my case the launcher so that instead of having their functionality i would change the constructor and create an intent to an external apk. Im not sure if it will execute with the same privileges though but im pretty sure they are not necessary anyways. If someone else has any ideas/further clarifications i would be glad to hear!

Thanks [MENTION=1844875]CosmicDan[/MENTION]
[Android Software Development] CosmicDan:
That isnt possible, basic Android security forbids it. Both packages need the same signature or UID.

But yeah, off topic.
[Android Software Development] Lanchon:
no it wont. an android apk is dalvik code + manifest + android resources + java resources + some extra stuff. code alone wont work, thats why all the other stuff is there in the apk.
[Android Software Development] Lanchon:
it will run with the permissions of your new app.

you can use apktool to take apart an apk and replace the guts. or with some work you can use the android sdk to create a new app using the manifest extracted by apktool.
[Android Software Development] CosmicDan:
Really? System apps are allowed to call any intent on another user package regardless? That seems insecure.
[Android Software Development] Lanchon:
my intuition is that there shouldn't be any trouble. (also, i don't see a security issue with these actions.)
[Android Software Development] CosmicDan:
Fair enough, I suppose not these days when AVB and stuff is pretty standard.
[Android Software Development] ashwarsadh:
Aapt Error Code 3

Hello [MENTION=4141005]Lanchon[/MENTION],

I am editing an apk which was build using Aapt2, I was also getting resources starting with $ error, i removed $ sign from all resources and i was able to recompile apk successfully from apktool from aapt(1) , but when I compile in dexpatcher I get following error:

Process 'command 'C:\path\to\Android\Sdk\build-tools\27.0.3\aapt.exe'' finished with non-zero exit value 3

I have tried various build tools using buildToolsVersion '25.0.1' , default, lower and 27.0.3

I get above error in step:

patched: processDebugResources

I checked from apktool using -a flag and used build-tools aapt.exe and all were crashing, so I extracted the aapt.exe from apktool.jar and overwrite in my build-tools folder, then I was able to compile.

So I suggest to kindly use apktool's inbuilt aapt.exe and /or provide a optional flag to use from build tools.

I also suggest you please add feature to remove $ sign from all resources starting with $ automatically after extracting the source.
[Android Software Development] Ydriod/YdroidExpo:
Need Help

its say command not found?:confused:
[Android Software Development] CosmicDan:
You should probably have a basic understanding of how to use Linux/Bash to use this stuff.
[Android Software Development] juanse254:
Dont be an asshole, point out the right direction for this guy. What the hell is wrong with people nowadays. Dude in order to execute commands in linux/unix you need to specify by ./nameoftheexecutable . If you need further help some programs also include help with the -h flag.
[Android Software Development] CosmicDan:
It's a toolkit for developers. People who know how to develop in Java. That is Day 1 Linux basics and assumed knowledge.

What the hell is wrong with people is that people think they have the chops to be an Android developer without even knowing basic computer skills. Your offense is completely unjustified and your hand-holding isn't doing anybody any favours. This isn't a thread for teaching people how to use Linux.

Sorry that my bluntness in stating a simple fact offended you so much. I did point him in the right direction - to google how to use basic Linux commands. If he couldn't figure that out then that just proves my point.
[Android Software Development] juanse254:
As a reminder there are Java devs coming from Windows which probably never used their batch console before. I think is pretty concited to say you cant be an Android developer if you cant use the unix command line.

I don't see any offense in my post and if pointing the right direction for you means saying "if you don't know how to use it then don't" then I guess your comment doesn't hold much value either.

Let's be a little more easy going with people that is trying to learn (the guy installed Linux) instead of being smartasses and pretend we know everything and everyone else is garbage.
[Android Software Development] CosmicDan:
I'm pretty sure DexPatcher can be used on Windows though. I was when I was using it. This guy is using Linux by choice, but doesn't know anything about bash. So my point remains - this isn't a thread for teaching how to use Linux.

I don't know why you were offended by my suggestion of going to learn basic Linux stuff. You gave him a fish, I told him that he should learn how to fish. One could argue that I was actually more helpful in the long run.

Anyway, this is off topic - I'm not going to engage on this white-knight-syndrome coddling anymore.
[Android Software Development] Lanchon:
> I suggest to kindly use apktool's inbuilt aapt.exe and /or provide a optional flag to use from build tools.

aapt 1 or 2 is chosen and used by the android build system (android gradle plugin), not by my plugins. if you want to use a different aapt you need to configure the android gradle plugin to use your aapt (if such a thing is possible), or patch the android build system, or ask google for a way to configure the aapt executable, or ask google to fix their aapt (if applicable).

> I also suggest you please add feature to remove $ sign from all resources starting with $ automatically after extracting the source.

absolutely not. i don't know what is the significance of resource names starting with $, and what is their relationship with aapt2 if any, and why they crash the android build. but for sure removing the $ is not the solution.

dexpatcher's gradle plugins are compatible with android plugin versions specified in the plugin release notes. they are not compatible with android plugin 3.x or its aapt2. if you have a compelling case for pushing a 3.x rewrite of my plugins, i'm all ears. for now, no one has presented evidence linking $, aapt2, and android plugin 3.x. (i'm not saying they are not linked, i just say that no one has presented evidence.)
[Android Software Development] Lanchon:
sorry, i never saw your message before!

> I made a new file under patched/java/com/fasterxml/jackson/core/package-info.java

In that file, I have the following:

Code:

*DexRemove(target = "com.fasterxml.jackson.core", recursive = true)

package remove_com_fasterxml_jackson_core;

import lanchon.dexpatcher.annotation.*;

that file should be "patched/java/remove_com_fasterxml_jackson_core/package-info.java"

as clearly the package is remove_com_fasterxml_jackson_core.

i cant really look at this in my cellphone right now. it will have to wait​
[Android Software Development] Lanchon:
some decoded apks cannot be rebuilt by aapt. that's why apktool includes its own patched version of aapt. if you extract it and replace your currently used aapt, it will possibly rebuild. i don't know whether the android gradle plugin has a way to configure the path of the aapt tool.
[Android Software Development] bergahisense:
First of all, thank you so much for providing such a fantastic tool.

I have unzipped and replaced the aapt in my Android SDK folder. This seems to have worked. Perhaps this should be noted in the documentation or be automated somehow.

When trying to run on an Android TV emulator in Android Studio I got:

The APK file /Users/marc/Dex/dexpatcher-gradle-samples2/patched-app/patched/build/outputs/apk/patched-debug.apk does not exist on disk.
Error while Installing APK

However, the file does exist and I was able to install it using adb later on.
[Android Software Development] Lanchon:
for what's worth, i've seen adb install fail intermittently for no reason. thanks!
[Android Software Development] bergahisense:
Correct, it seems to work now. Thank you so much Lanchon, I have donated $10 for this wonderful tool you have created.
[Android Software Development] Lanchon:
i think you are the first person ever to donate for DxP. thank you very much, really. btw you're paying for lunch today :)
[Android Software Development] bergahisense:
Is there way with DexPatcher to lower the minSDK and targetSDK versions?

I keep getting errors about missing the main class of the application, or others about "unrecognized version number 0 3 8" when launching the app.

I don't expect the app to have any recent API calls requiring that SDK.
[Android Software Development] CosmicDan:
Probably not. Standard way of specifying hard SDK requirements is in the manifest, not the app code.
[Android Software Development] vishal.kadam:
$ sign in resource, build error

[MENTION=4141005]Lanchon[/MENTION],

I have copied your gradle sample project and added my test-app.apk inside it (removed your makeinfo one). But I am getting following error

dexpatcher-gradle-samples/patched/build/intermediates/exploded-aar/dexpatcher-gradle-samples/source/unspecified/res/drawable-v21/$avd_show_password__2.xml:
Error: '$' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore

I have also used just apktool and I was able to decode and build correctly w/o any issue. I have pushed my code to a private repo at "gitlab" under my user name "vkadam" with repo name "dexpatcher-sample" [not allowed to post url here as this is my first post ;)], first commit it with makeinfo apk and second commit is with my test-app. I have provided you access to repo.

Any help will be appreciated.

Thanks
[Android Software Development] Lanchon:
sorry i didnt get notifications for this message, i dont know why.
[Android Software Development] Lanchon:
this problem has been discussed here and in the apktool threads.
[Android Software Development] Lanchon:
UPDATE: DexPatcher-tool v1.6.2 is out!

https://github.com/DexPatcher/dexpatcher-tool/releases
[Android Software Development] 09354726725:
hello dear

- please make a video tutorial for DexPatcher Android Studio

- Does the DexPathcer work on the Android Studio 3.1.4 ?

thank you
[Android Software Development] vishal.kadam:
[MENTION=4141005]Lanchon[/MENTION],

I did read through all the post in this thread and on apktool, but haven't found a solution.

As I mentioned I am able to decompile and compile it with apktool only, but unable to do it with the dexpatcher.

I am using gatling plugin version

dependencies {
// Android Gradle plugins:
classpath 'com.android.tools.build:gradle:2.2.3'
// DexPatcher Gradle plugins:
classpath 'com.github.lanchon.dexpatcher:dexpatcher-gradle:1.0.0'
}

Here is my gradle.properties looks like

org.gradle.jvmargs=-Xmx1536M
android.enableAapt2=false

I have already provide the access to you for source code on gitlab. Any help on this would be helpful.