Giter Club home page Giter Club logo

Comments (9)

git360Flip avatar git360Flip commented on May 30, 2024 1

Ok I just found it:

In my build.gradle (app) I was using this line:

compileOnly 'com.crossbowffs.remotepreferences:remotepreferences:0.7'

I just replace it by:

implementation 'com.crossbowffs.remotepreferences:remotepreferences:0.7'

Like I said i'm really a beginner at Android Development and Xposed and I didn't know that we have to use implementation instead of compileOnly that I have to use for Xposed

Thanks you for your help, and for your useful library :)

from remotepreferences.

apsun avatar apsun commented on May 30, 2024

From what I can tell from the stacktrace, it seems like the Xposed hook is being applied to the same process where the preference provider is running. This is a strange setup, since you could have just used a plain old SharedPreferences to do this. Can you explain the setup you are trying to achieve, and how you are actually calling the RemotePreferences API? (A minimum reproducible example would be great)

from remotepreferences.

git360Flip avatar git360Flip commented on May 30, 2024

Wow thanks you for your quick reply!

My applications contains 3 important classes:

  • Xposed Class: I use only for the HandleLoadPackage, my goal is to read SharedPreferences of my application with XSharedPreferences in all methods that I perform a Hook (I want to use the RemotePreference here to replace my bad solution)
  • MyPreferenceProvider: A minimalist class which looks exactly like the example in Installation for setting up the RemotePreferences
  • MainActivity: I use a SharedPreferences for stocking and updating values that a user can define with TextInput, and I want theses values to be read from all methods that I perform a Hook in the XposedClass, in HandleLoadPackage.

I have found solution with Su requests for forcing read access from other applications to SharedPreferences of mine, and by this way, XSharedPreferences works, but this is really unstable and not the solution that I will use.
(When an application wants to read SharedPreferences of mine, a SU request from this application is sended for the chmod and this is really not good)

Thanks you for your help, I really appreciate that :)

from remotepreferences.

apsun avatar apsun commented on May 30, 2024

Right, the issue I see is that it looks like you hooked handleBindApplication inside the app where the RemotePreferenceProvider is. If you try to use RemotePreferences within that hook, it will end up with infinite recursion. That said, that doesn't seem to be the case here, so I'll ignore it for now.

Since it's throwing ClassNotFoundException, can you check if you have ProGuard enabled? If so try disabling it; I think it should be smart enough to ignore things defined in the manifest, but maybe not.

If that doesn't help, please upload the code of your app, without more info I can't really tell what's going on. Thanks.

from remotepreferences.

git360Flip avatar git360Flip commented on May 30, 2024

I don't hook the handleBindApplication in my XposedClass on my application.

I'm currently trying to disable ProGuard in Android Studio.

There is an update:
With the same setup (I just moved the declaration of RemotePreferences inside a afterHookedMethod on the HandleLoadPackage of my XposedClass on my application):
SharedPreferences prefs = new RemotePreferences(AndroidAppHelper.currentApplication(), "com.myapp.test.preferences", "test");

Now this line give me that error when i'm using outside of my application a hookedMethod:
2021-01-17 04:30:35.795 6709-6709/com.android.dialer E/Xposed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/crossbowffs/remotepreferences/RemotePreferences; at com.myapp.test.XposedClass$8.afterHookedMethod(XposedClass.java:280)

I think it's because inside Hook we are in the other application Context and this application didn't load the RemotePreferences Library.

My application crash at launch now with this error:
Rejecting re-init on previously-failed class java.lang.Class<com.myapp.test.MyPreferenceProvider>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/crossbowffs/remotepreferences/RemotePreferenceProvider

Do you have any idea to make it works ?
Thanks you

from remotepreferences.

apsun avatar apsun commented on May 30, 2024

Probably either ProGuard or your build setup is misconfigured. Again, without the code I can't really say.

from remotepreferences.

git360Flip avatar git360Flip commented on May 30, 2024

Ok, thanks you for your time.
Because I'm really new to develop android app, I will give you in one hour my entire project with Github

from remotepreferences.

git360Flip avatar git360Flip commented on May 30, 2024

And there you go: https://github.com/git360Flip/TestXposedRemotePreferences
I keep the code very minimalist for only checking what is not working :)

UPDATE: It's seems to works! I really don't know why I just re wrote this project in 30 minutes.. I'm currently trying to understand why this project works and not my original one, I will tell you when I found it

from remotepreferences.

apsun avatar apsun commented on May 30, 2024

Ah, I didn't realize the readme is still using the deprecated compile directive (rolls eyes)... Yeah compile translates to implementation, not compileOnly (who thought that was a good idea?!) Let me fix that, sorry about the confusion!

from remotepreferences.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.