rovo89 / XposedBridge

The Java part of the Xposed framework.
3.86k stars 1.1k forks source link

Xposed makes Xamarin apps crash #50

Open karimjouini opened 9 years ago

karimjouini commented 9 years ago

Seems to be due to this: https://github.com/rovo89/XposedBridge/blob/master/src/android/content/res/XResources.java#L993

Basically, calling obtainStyledAttributes should return a TypedArray, this gets replaces by XTypedArray by XPosed, and Xamarin fails to call its methods

see stack trace:

https://forums.xamarin.com/discussion/comment/130409#Comment_130409

Can you help us understand:

Thanks, Karim

rovo89 commented 9 years ago

Please calm down. Why would this be "URGENT"? The XTypedArray replacement has been active for more than a year.

Do you have a small test I could use for reproducing this issue?

karimjouini commented 9 years ago

Sorry about the URGENT, I am new to XPosed, I actually heard about it because my apps crash on ROMs that contain XPosed :)

About the test: this lib: https://github.com/Cheesebaron/SlidingMenuSharp crashes when XPosed is installed

You could also download our app: Expensya (email me I'll give you a test account)

pylerSM commented 9 years ago

How to detect if Xposed is installed (to help the user understand)? Simply check for package "de.robv.android.xposed.installer"

karimjouini commented 9 years ago

Thanks, but can that be done programmatically ? (so I can, on my app startup, tell to the user: "Oops we can't run with XPosed active")

manvir-singh commented 9 years ago

You can use this to check if Xposed is installed I've used it before works like a charm

try {
            getActivity().createPackageContext("de.robv.android.xposed.installer", Context.CONTEXT_IGNORE_SECURITY);
            //Xposed is installed show your message here "Oops we can't run with Xposed active"
        } catch (NameNotFoundException ignore){
            //Xposed isn't installed so continue to run your app
        }
pylerSM commented 9 years ago

Use try catch with this code getPackageManager().getPackageInfo(Xposed_PKG, 0);

pylerSM commented 9 years ago

And why is TypedArray replaced?

rovo89 commented 9 years ago

For resource replacement. Otherwise, I would have to hook all of its methods, and as they are called very often, that would be much overhead.

tonyp commented 9 years ago

@karimjouini: As you asked about a workaround: At the Xposed Installer (which is used to manage the modules) there's an option "Disabled resource hooks" which might be a solution for affected users at the moment.