Comments (9)
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.
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.
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.
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.
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.
Probably either ProGuard or your build setup is misconfigured. Again, without the code I can't really say.
from remotepreferences.
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.
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.
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)
- [QUESTION] How to get preferences from Android system package? HOT 6
- I don't understand how to declare "context" HOT 2
- Android 10 return default value HOT 8
- Exception thrown when accessing preferences from Xposed (Android 11) HOT 10
- [Please Delete] Non-issue. HOT 2
- No exception thrown when Key is NULL HOT 2
- Move away from jcenter HOT 2
- Is it Solve Xsharedpreference Canβt Access Preference XML HOT 3
- App closed when try to use RemotePreference HOT 5
- [INFO] java.lang.SecurityException: Given calling package android does not match caller's uid HOT 6
- Variable preference name? HOT 5
- Does not work when trying to access via Xposed on an app targeting Android 11 HOT 16
- multiple apps use the library but they have same authority for a content provider, which creates conflict HOT 1
- Android 13:RemotePreferenceAccessException: query() failed or returned null cursor HOT 1
- getting context in handleLoadPackage HOT 4
- [Question] RemotePreferences not loaded after Android reboot HOT 4
- Cannot get preferences when application get killed HOT 6
- Should checkAccess check for the preferences owner package? HOT 4
- Unable to launch app **** for provider **** process is bad HOT 4
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 remotepreferences.