Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Thread Closed

Xposed - Legacy thread. Don't panic, Xposed is still here.

OP rovo89

23rd March 2014, 06:40 PM   |  #9901  
Senior Member
Thanks Meter: 28
 
144 posts
Join Date:Joined: Aug 2007
Thumbs up It Worked!!!
Quote:
Originally Posted by Vagelis1608

Go to Xposed Installer -> Settings -> Installation mode and choose recovery. Then go to Xposed Installer -> Framework -> Install/Update and reboot.

Thank you very much!

Have a nice weekend
The Following User Says Thank You to nostromo76 For This Useful Post: [ View ]
23rd March 2014, 06:54 PM   |  #9902  
rovo89's Avatar
OP Senior Recognized Developer
Thanks Meter: 15,411
 
2,386 posts
Join Date:Joined: Jan 2012
More
Quote:
Originally Posted by Bob1732

Sorry to bother again, after a few hours reading and trying i am still in need of a bit of assitance.

OnCreate wasnt working the way i intended so i switched to a loadlibrary hook, i intended to load my library after the last unique library is loaded from the application, i need to obviously add in the param result check to make sure lib is loaded successfully but at the moment i can see through catlog the lib is loaded without a problem.

The lib i am using is just the sample/hello-jni from NDK

Defined as:
jstring Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env,
jobject thiz )

public native String stringFromJNI(); // should just return a simple string

so com.example.hellojni.HelloJni.stringFromJNI(); is what i wanna call, trying the following i always get a class not found exception.

Code:
try {
	Class<?> exampleclass = XposedHelpers.findClass("com.example.hellojni.HelloJni", (ClassLoader)lpparam.classLoader);

	if (exampleclass != null){
		XposedBridge.log("NativeCALL-Result: " + (String)exampleclass.getMethod("stringFromJNI").invoke(null));
	}

} catch (Exception e) {
	e.printStackTrace();
}
any clue ? i know the library is loaded successfully through cat log.

First of all, have you verified the your library is working fine in a "normal" app? Before that, I wouldn't try to do such calls in an Xposed module.
I believe a difficulty with this are the class loaders. You are looking for the HelloJni class in the app - is it defined in the app? Or your module? If it's in your module, then you should be able to avoid reflection completely, but you need to make sure that the library is loaded for the right classloader. System.loadLibrary() takes that caller's loader, whereas you look for the class in param.classLoader...
23rd March 2014, 07:05 PM   |  #9903  
Junior Member
Thanks Meter: 1
 
6 posts
Join Date:Joined: Mar 2014
Quote:
Originally Posted by rovo89

First of all, have you verified the your library is working fine in a "normal" app? Before that, I wouldn't try to do such calls in an Xposed module.
I believe a difficulty with this are the class loaders. You are looking for the HelloJni class in the app - is it defined in the app? Or your module? If it's in your module, then you should be able to avoid reflection completely, but you need to make sure that the library is loaded for the right classloader. System.loadLibrary() takes that caller's loader, whereas you look for the class in param.classLoader...

Thanks again for your time.

The package i want to hook is called "com.test.test"

the package com.example.hellojni does not exist, i only have this function defined inside the shared library.. maybe this is a limitation or a misunderstanding from me.

The method and class would never exist inside the package, but the way i understood it was i could system.loadlibrary and that defined class would be added to the program.

Perhaps i need to rename my function to REALPACKAGE.CLASS.METHOD instead of com.example.hellojni, going to try this and keep trying.
Last edited by Bob1732; 23rd March 2014 at 07:20 PM.
23rd March 2014, 07:25 PM   |  #9904  
rovo89's Avatar
OP Senior Recognized Developer
Thanks Meter: 15,411
 
2,386 posts
Join Date:Joined: Jan 2012
More
Quote:
Originally Posted by Bob1732

The method and class would never exist inside the package, but the way i understood it was i could system.loadlibrary and that defined class would be added to the program.

Perhaps i need to rename my function to REALPACKAGE.CLASS.METHOD instead of com.example.hellojni, going to try this and keep trying.

The Java class containing the native methods definitely needs to be loaded by any classloader, and then you must load the native library for the same classloader. During the initialization, the native library should then connect the C++ functions to the Java stub. Not sure if you need to do this manually for real JNI, at least the system libraries explicitely register their methods.

If com.example.hellojni.HelloJni isn't part of com.test.test, then you have to include it in your module or load it from another jar file. Renaming doesn't change anything about this, you can have two classes with the same name and package and yet they won't be the same unless they are also loaded by the same classloader.
The Following User Says Thank You to rovo89 For This Useful Post: [ View ]
23rd March 2014, 07:58 PM   |  #9905  
MgudFrn's Avatar
Member
Flag Kathmandu
Thanks Meter: 9
 
69 posts
Join Date:Joined: Oct 2013
Donate to Me
Quote:
Originally Posted by rovo89

This is Xposed version 2.5 (final). The main new features and fixes in this version are:

  • Rewritten framework installation/uninstallation
    • Uses interactive su (via libsuperuser) to provide improved compatibility with different Superuser apps
    • Better feedback when root access fails (doesn't freeze the app anymore)
    • Offers installation via custom recovery (CWM/TWRP), either flashing the file automatically or manually
  • Safemode to disable Xposed with hardware keys to get out of (most) bootloops
  • Compatibility with Sony/LG ROMs (4.3 and 4.4), Meizu ROMs (4.4)
  • Debug setting to disable resource hooking as a temporary workaround for incompatibilities with some theming engines (not all modules can be used in this mode)
There are also other improvements and fixes, especially many translations updates.

I'm getting Segmentation Fault in this version. I tried installing using all three methods but there is same problem.
Previous version works fine.

Quote:
Originally Posted by rovo89

In case you get a message "Segmentation fault" during installation, you can now download an additional app which provides statically compiled versions of BusyBox (a lot bigger, but should work with every ROM). It's not needed otherwise.

Where is that additional app? Please see my attachment for actual error message:

Click image for larger version

Name:	uploadfromtaptalk1395597492356.jpg
Views:	2757
Size:	27.8 KB
ID:	2645989

Sent from my Karbonn A1* using xda app-developers app
Last edited by MgudFrn; 23rd March 2014 at 08:01 PM.
The Following User Says Thank You to MgudFrn For This Useful Post: [ View ]
23rd March 2014, 08:04 PM   |  #9906  
Junior Member
Thanks Meter: 1
 
6 posts
Join Date:Joined: Mar 2014
Quote:
Originally Posted by rovo89

The Java class containing the native methods definitely needs to be loaded by any classloader,

There is the problem then, I assumed the loaded library added the method automatically but when I think about it, it can't add the method when the class doesn't exist makes sense now. All a little over my head at the moment, need to learn a lot more about how java works.

For now I will just use jni_onload to set up the hooks but I look forward to being able to learn a more advanced way.

Really many thanks for your time.
23rd March 2014, 08:21 PM   |  #9907  
hamzahrmalik's Avatar
Senior Member
Thanks Meter: 1,455
 
1,205 posts
Join Date:Joined: May 2013
Donate to Me
More
I need help editing dimens.xml in framework-res.apk using Xposed
I am trying to make a very simple module which will simply replace navigation_bar_height property with a user defined value. At the moment, since the module is in early development, it simply sets it to 20 (no configurable option). The default is 48 on my phone so I think I should be seeing a difference, but I'm not. I'm not sure if it is failing to replace the resource, or if it is replacing but then ignoring the new value. Here is the code

Code:
import android.content.res.XResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XposedBridge;

public class Main implements IXposedHookZygoteInit{

	@Override
	public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
		XposedBridge.log("LOADED");
		try {
			XResources.setSystemWideReplacement("android", "dimen", "navigation_bar_height", 20.0);
		
	} catch (Throwable t) { XposedBridge.log(t); }
	}

}
Any help is appreciated
The Following User Says Thank You to hamzahrmalik For This Useful Post: [ View ]
23rd March 2014, 08:28 PM   |  #9908  
rovo89's Avatar
OP Senior Recognized Developer
Thanks Meter: 15,411
 
2,386 posts
Join Date:Joined: Jan 2012
More
Talking
Quote:
Originally Posted by MgudFrn

I'm getting Segmentation Fault in this version. I tried installing using all three methods but there is same problem.
Previous version works fine.

Where is that additional app? Please see my attachment for actual error message:

Attachment 2645989

Here it is. I wanted to know how frequently this error occurs - not too often as it seems.
Just as a reminder: This file is only needed when you get "Segmentation fault" errors.
Attached Files
File Type: apk XposedInstallerStaticBusyBox_v1.apk - [Click for QR Code] (279.3 KB, 27647 views)
The Following 51 Users Say Thank You to rovo89 For This Useful Post: [ View ]
23rd March 2014, 08:34 PM   |  #9909  
rovo89's Avatar
OP Senior Recognized Developer
Thanks Meter: 15,411
 
2,386 posts
Join Date:Joined: Jan 2012
More
Quote:
Originally Posted by hamzahrmalik

I am trying to make a very simple module which will simply replace navigation_bar_height property with a user defined value. At the moment, since the module is in early development, it simply sets it to 20 (no configurable option). The default is 48 on my phone so I think I should be seeing a difference, but I'm not. I'm not sure if it is failing to replace the resource, or if it is replacing but then ignoring the new value.

At the moment, it's not possible to replace dimension resources with variables/literals. You can only forward it to your module's resources: https://github.com/rovo89/XposedBrid...plex-resources
23rd March 2014, 08:38 PM   |  #9910  
mattie_49's Avatar
Senior Member
Thanks Meter: 232
 
961 posts
Join Date:Joined: Feb 2010
Is today's update compatible with art?

Sent from my SCH-R970 using Tapatalk

Thread Closed Subscribe to Thread

Tags
don't ask questions about modules here!!!, framework, xposed
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes