Comments (17)
加油, Dexposed 是一个好东西,必将造福程序猿界!
from dexposed.
Thank you very much! These suggestions are valuable. I will improve after evaluation.
from dexposed.
There was some obstacle on uploading snapshot version to JCenter, so I upload 0.2.2 version for android 5.0 test. Can anybody help me to test this version, thank you!. Notice, 0.2.2 is still a snapshot version!
dependencies {
compile( 'com.taobao.android:dexposed:0.1.2@aar')
}
from dexposed.
@hwjump I found a problem when use dexposed on Android 5.1 System.
I found a 0.1.17 version of Dexposed in Maven Central, it support 5.1 system by default.
It seems that dexposed did not automatically load system api classes, like Toast.
First, I writed a test Patch, which hoke a ToastUtil, which code is below:
public class ToastUtil {
private static Handler sMainHandler = new Handler(Looper.getMainLooper());
public static void showMessage(final String text, final int duration) {
if (Thread.currentThread().getId() != 1) {
sMainHandler.post(new Runnable() {
@Override
public void run() {
showMessage(text, duration);
}
});
return;
}
if (TextUtil.isEmptyOrNull(text)) {
showMessage(R.string.action_error);
return;
}
Toast t = Toast.makeText(APP.getInstance(), text, duration);
t.setGravity(Gravity.CENTER, 0, 0);
TextView tv = (TextView) t.getView().findViewById(android.R.id.message);
if (tv != null) tv.setTextColor(APP.getInstance().getResources().getColor(R.color.white_light));
t.getView().setBackgroundResource(R.drawable.progress_hud_bg);
t.show();
}
}
It's easy, just some utils code for Toast.
The patch code is like this:
public class TestPatch implements IPatch {
private Handler mHandler = new Handler(Looper.getMainLooper());
@Override
public void handlePatch(PatchParam patchParam) throws Throwable {
DexposedBridge.findAndHookMethod(
Class.forName("cn.app.meiya.aa.util.ToastUtil"),
"showMessage",
String.class, int.class,
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(final MethodHookParam methodHookParam) throws Throwable {
if (Thread.currentThread().getId() != 1) {
mHandler.post(new Runnable() {
@Override
public void run() {
showFakeMessage(methodHookParam);
}
});
} else {
showFakeMessage(methodHookParam);
}
return null;
}
}
);
}
private void showFakeMessage(XC_MethodHook.MethodHookParam methodHookParam) {
try {
Context app = (Context) XposedHelpers.callStaticMethod(
Class.forName("com.meiyaapp.meiya.APP"), "getInstance");
String text = (String) methodHookParam.args[0];
int duration = (int) methodHookParam.args[1];
Toast.makeText(app, "FAKE: \n" + text, Toast.LENGTH_LONG).show();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Then, I package a "Test-Patch" apk and load it on main app, but it crashed when Call "ToastUtil.showMessage".
The crash only print this, can not find any stacktrace.
10-08 09:43:55.422 17987-17987/com.meiyaapp.meiya A/libc﹕ Fatal signal 11 (SIGSEGV), code 1, fault addr 0xbe98e2f4 in tid 17987 (.meiyaapp.meiya)
And I found strange that when I CALL this before a next ToastUtil.showMessage, the patch code WORK!
Toast.makeText(context, "Load success", Toast.LENGTH_LONG).show();
So I think, maybe Dexposed DID NOT automatically load system api classes.
I know currently Dexposed only support dalvik runtime for now, I post this just want to help to test ART Runtime.
from dexposed.
@hwjump
update:
I try to load classes in patch apk, but still NOT work.
private void showFakeMessage(ClassLoader loader, XC_MethodHook.MethodHookParam methodHookParam) {
try {
Context app = (Context) XposedHelpers.callStaticMethod(
Class.forName("com.meiyaapp.meiya.APP"), "getInstance");
String text = (String) methodHookParam.args[0];
int duration = (int) methodHookParam.args[1];
Log.d(TAG, "showFakeMessage: " + "before");
Object toast = XposedHelpers.callStaticMethod(loader.loadClass("android.widget.Toast"), "makeText", "FAKE: \n" + text, 1);
Log.d(TAG, "showFakeMessage: " + "Toast.makeText");
XposedHelpers.callMethod(toast, "show");
Log.d(TAG, "showFakeMessage: " + "Toast.show");
} catch (Exception e) {
e.printStackTrace();
}
}
It crashed on this line:
Object toast = XposedHelpers.callStaticMethod(loader.loadClass("android.widget.Toast"), "makeText", "FAKE: \n" + text, 1);
from dexposed.
@fanxu123 could you tell me your phone type and android version, 5.0 or 5.1?
from dexposed.
@hwjump Nexus 5, Android 5.1, Stock
from dexposed.
thank you! dexposed 0.1.7 was still a snapshot for art. I found it cann't do some system ui relative class in XC_MethodReplacement.
from dexposed.
@hwjump Btw, if I want use it on my product version only for pre-5.0, arm device, which version should I use, 0.1.1? 0.1.7?
from dexposed.
@fanxu123 sorry,If I support art, I will change the README.md. for pre-5.0, you can use 0.1.1
from dexposed.
@hwjump Thanks!
from dexposed.
我想问下,dexposed支持混淆后的包么?混淆后类名方法名会被修改了,怎么hook呢?
from dexposed.
@owenchow You should keep the proguard mapping. Then hook the method with proguarded name.
Plz refer this #5
from dexposed.
再问下,怎么修改重载函数,findAndHookMethod只能找到方法名,如果是重载了,怎么区分?
from dexposed.
@owenchow findAndHookMethod的函数原型是findAndHookMethod(类名, 方法名, 参数1的class, 参数2的class, ... , Hook func)
所以是可以区分重载的。。。
from dexposed.
Now I rewriter the hook core for Art, it may still have some crash, it need test, you can get it on "dev_art" branch.
from dexposed.
问题来了,在一年多后的今天
dexposed还会有更新吗?
from dexposed.
Related Issues (20)
- Dexposed停止更新了吗 HOT 4
- How can I load the patch's image resource? HOT 2
- Build Issues with AOSP HOT 2
- dexposed对art的支持什么时候可以更新到 HOT 2
- Duplicate files copied in APK HOT 2
- AndFix针对JNI c回调JAVA各种bug,dexposed听说可以hook native层? HOT 5
- method循环调用 HOT 3
- Class ref in pre-verified class resolved to unexpected implementation HOT 1
- StackOverflowError
- Support ART? HOT 1
- 为毛我觉得这项目已经死了。。 HOT 5
- Android 6.0支持? HOT 1
- update? HOT 1
- 请问dexposed后期还会更新吗?会支持高版本系统吗? HOT 2
- Is this lib still being developing? HOT 1
- 红米Note2 MIUI8 5.0.1闪退,dev_art HOT 1
- 小米4 CM13闪退 HOT 2
- 兼容性极差,进去就crash HOT 1
- 请问是停止维护了吗。。
- hook构造方法的时候 有几率不生效 华为P20 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dexposed.