Whatsapp ART support

cernekee

Senior Member
Jun 2, 2013
186
423
0
Do you think we could apply the same tweaks to get Titanium backup working?
Unfortunately that looks like a different error:

Code:
I/dex2oat ( 7444): dex2oat: /data/data/com.keramidas.TitaniumBackup/.臉씫쁃
I/dex2oat ( 7448): dex2oat: /data/data/com.keramidas.TitaniumBackup/.臉씫쁃
I/dex2oat ( 7448): Verification error in java.lang.Boolean o.fp.鷭(long, java.lang.String, java.lang.String)
E/dex2oat ( 7448): Verification failed on class o.fp in /data/data/com.keramidas.TitaniumBackup/.箧쌌玝 because: Verifier rejected class o.fp due to bad method java.lang.Boolean o.fp.鷭(long, java.lang.String, java.lang.String)
I/art     ( 7420): Rejecting re-init on previously-failed class java.lang.Class<o.fp>
W/o.hq    ( 7420): SafeRunnable caught an exception.
W/o.hq    ( 7420): java.lang.VerifyError: o.fp
W/o.hq    ( 7420): 	at dalvik.system.DexFile.defineClassNative(Native Method)
W/o.hq    ( 7420): 	at dalvik.system.DexFile.defineClass(DexFile.java:222)
W/o.hq    ( 7420): 	at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:215)
W/o.hq    ( 7420): 	at dalvik.system.DexFile.loadClass(DexFile.java:204)
W/o.hq    ( 7420): 	at java.lang.reflect.Method.invoke(Native Method)
W/o.hq    ( 7420): 	at o.fp$CON.findClass(Unknown Source)
W/o.hq    ( 7420): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
W/o.hq    ( 7420): 	at o.fp$CON.ˮ͈(Unknown Source)
W/o.hq    ( 7420): 	at java.lang.reflect.Method.invoke(Native Method)
W/o.hq    ( 7420): 	at o.fp$cON.鷭(Unknown Source)
W/o.hq    ( 7420): 	at com.keramidas.TitaniumBackup.MainApplication.鷭(Source:611)
W/o.hq    ( 7420): 	at o.零.鷭(Source:376)
W/o.hq    ( 7420): 	at o.hq.run(Source:20)
W/o.hq    ( 7420): 	at android.os.Handler.handleCallback(Handler.java:733)
W/o.hq    ( 7420): 	at android.os.Handler.dispatchMessage(Handler.java:95)
W/o.hq    ( 7420): 	at android.os.Looper.loop(Looper.java:137)
W/o.hq    ( 7420): 	at android.app.ActivityThread.main(ActivityThread.java:4998)
W/o.hq    ( 7420): 	at java.lang.reflect.Method.invoke(Native Method)
W/o.hq    ( 7420): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
W/o.hq    ( 7420): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
[b]E/art     ( 7420): invalid stream - problem with parameter iterator in /data/app/com.keramidas.TitaniumBackup-1.apk[/b]
E/AndroidRuntime( 7420): FATAL EXCEPTION: Thread-266
E/AndroidRuntime( 7420): Process: com.keramidas.TitaniumBackup, PID: 7420
E/AndroidRuntime( 7420): java.lang.NullPointerException: throw with null exception
E/AndroidRuntime( 7420): 	at com.keramidas.TitaniumBackup.MainApplication.鷭(Source)
E/AndroidRuntime( 7420): 	at o.羇.run(Source:419)
W/ActivityManager(  621):   Force finishing activity com.keramidas.TitaniumBackup/.MainActivity
In this case, the verifier may be having trouble figuring out the correct number of parameters in a method prototype (see DexFile:: DecodeDebugInfo0).

Do we have any .dex file format experts here?
 
  • Like
Reactions: Fight4Music

akhan47

Senior Member
Oct 21, 2012
449
237
0
Per the hints from Google, I was able to get current versions of WhatsApp to install under ART by overriding one of the verifier checks.

Here is the procedure to replace libart.so and clean up any partially-installed WhatsApp package, tested on a Nexus 5 running AOSP 4.4:

Code:
adb root
adb remount
adb shell "rm -rf /data/data/com.whatsapp"
adb pull /system/lib/libart.so libart.so.bak
adb push libart.so /system/lib/
If something goes wrong it may well result in a bootloop, so if you need to restore from backup, boot to recovery and use:

Code:
adb shell "mount /system"
adb push libart.so.bak /system/lib/libart.so
Source changes: https://github.com/cernekee/android_art/commit/fc2ac71d0d9e147c607bff9371fe2ef25d8470af

Note that I have not tested this on a Nexus 4 (despite this thread's current location).
Thank you!
 

deepayanneogi

Senior Member
Apr 15, 2012
525
92
0
Hyderabad
Per the hints from Google, I was able to get current versions of WhatsApp to install under ART by overriding one of the verifier checks.

Here is the procedure to replace libart.so and clean up any partially-installed WhatsApp package, tested on a Nexus 5 running AOSP 4.4:

Code:
adb root
adb remount
adb shell "rm -rf /data/data/com.whatsapp"
adb pull /system/lib/libart.so libart.so.bak
adb push libart.so /system/lib/
If something goes wrong it may well result in a bootloop, so if you need to restore from backup, boot to recovery and use:

Code:
adb shell "mount /system"
adb push libart.so.bak /system/lib/libart.so
Source changes: https://github.com/cernekee/android_art/commit/fc2ac71d0d9e147c607bff9371fe2ef25d8470af

Note that I have not tested this on a Nexus 4 (despite this thread's current location).
Can this libart be used with KRT16S or you need to compile a new one ?
 

chrone

Senior Member
May 5, 2012
1,050
369
0
Surabaya
Can this libart be used with KRT16S or you need to compile a new one ?
It works on KRT16S. :)

Sent from my Nexus 4

---------- Post added at 12:04 AM ---------- Previous post was at 12:01 AM ----------

Patched the source and rebuilt

Prior to making the change I had added some instrumentation to figure out why it was aborting, since the text sent to MethodVerifier::Fail() wasn't getting output anywhere (even in the "dex2oatd" debug builds).

BTW, to run it manually, you can do something like:

Code:
cd /data/local/tmp
dex2oat --zip-location=whatsapp.apk --zip-fd=3 --oat-file=test.oat 3< whatsapp.apk
while watching logcat in another window.
Hope you will keep this up to date with newer build and post it here. Thanks for the great work! :)


Sent from my Nexus 4
 
  • Like
Reactions: deepayanneogi

cannondale0815

Senior Member
Apr 21, 2009
583
216
63
Seriously I don't get why people like Whatsapp.

There are many alternative out there such as Viber or Line which provides better interface and actually adhere to Google guidelines.
Well, you use what you need to use to communicate with others. If everyone of your friends is using Viber, then great. But I doubt that.
 

taranfx

Senior Member
May 23, 2010
330
240
0
Mountain view, CA
geeknizer.com
In case someone doesn't understand what is ART, here's my easy explanation

Dalvik Runtime (the current place in memory where your apps are run) is being replaced with next generation ART (android runtime) in Android 5.x or later. Google has introduced it now so that developers can start testing their apps with it.

The older Dalvik uses what is called JIT runtime compiler which basically compiles java dex code to optimized native code (C binary) at the runtime.
The next gen ART uses AOT (Ahead of time) compiler which optimizes and converts java/dex code to Native during installation (ahead of time).

Both have their pros and cons, but overall AOT is faster than JIT. AOT is better at doing fast things really fast e.g. Scrolling a page in app (list, images, webview, etc) would be faster with AOT (used by ART), less often it would need to reclaim memory (GC -> garbage collector) vs. JIT.
JIT used by Dalvik has added advantages of being able to optimize java/dex code to native better, but it takes time to do so.

Overall ART should give faster launch times, smoother scrolling and better battery. Its still in alpha stage, we probably will see ART in Android 5.0 L-release doing wonders.
 

brar.arsh

Senior Member
Feb 5, 2012
2,098
857
0
GTA, Ontario
In case someone doesn't understand what is ART, here's my easy explanation

Dalvik Runtime (the current place in memory where your apps are run) is being replaced with next generation ART (android runtime) in Android 5.x or later. Google has introduced it now so that developers can start testing their apps with it.

The older Dalvik uses what is called JIT runtime compiler which basically compiles java dex code to optimized native code (C binary) at the runtime.
The next gen ART uses AOT (Ahead of time) compiler which optimizes and converts java/dex code to Native during installation (ahead of time).

Both have their pros and cons, but overall AOT is faster than JIT. AOT is better at doing fast things really fast e.g. Scrolling a page in app (list, images, webview, etc) would be faster with AOT (used by ART), less often it would need to reclaim memory (GC -> garbage collector) vs. JIT.
JIT used by Dalvik has added advantages of being able to optimize java/dex code to native better, but it takes time to do so.

Overall ART should give faster launch times, smoother scrolling and better battery. Its still in alpha stage, we probably will see ART in Android 5.0 L-release doing wonders.
THIS!!! :highfive: :good: