New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.save failing on Android O device #536
Comments
Same problem here, hope gets fixed soon |
same problem |
on latest android emulator works fine for me |
@uncledoc You're using Android 8.0.0 on the emulator? I'm still getting the same error on an emulator. |
Hi. |
Met the same issue on Android 8 |
I think my plan is to convert over to Google's new Room Persistence Library instead of using ActiveAndroid. It doesn't look like ActiveAndroid is maintained at all anymore. |
This can be fixed by adding <provider
android:name="com.activeandroid.content.ContentProvider"
android:authorities="<your.package.name>"
android:enabled="true"
android:exported="false">
</provider> to your manifest file. But I'd agree with @JacobVanAssche, if you can then move to a different library as this one hasn't been updated for a while and probably won't be. |
Importing the source code into your project and compile it with API 26 solved it. |
In my case it was fixed as following steps:
|
@martino2k6 solution work for me. |
if your package is different from your applicationId then you should use the applicationId <provider
android:name="com.activeandroid.content.ContentProvider"
android:authorities="${applicationId}"
android:exported="false" /> |
@martino2k6 & @ricardomorsch |
@adrianbudzynski AndroidManifest.xml <provider
android:name=".content.DatabaseContentProvider"
android:authorities="${applicationId}"
android:exported="false" /> DatabaseContentProvider.java ...
import com.activeandroid.content.ContentProvider;
...
public class DatabaseContentProvider extends ContentProvider {
@Override
protected Configuration getConfiguration() {
Configuration.Builder builder = new Configuration.Builder(getContext());
builder.addModelClass(SomeModel.class);
builder.addModelClass(OtherModel.class);
return builder.create();
}
} |
Solution by @joshuatam is working. To get a context at this line |
@azizimusa Thanks, corrected. |
Thanks @joshuatam, your solution is working. |
Hello, guys! You can use my library - https://github.com/ImangazalievM/ReActiveAndroid. I forked the ActiveAndroid and fixed all bugs. It works fine on Android O and other versions. @JacobVanAssche @agonper @zuiaichiyu @anninpavel @azizimusa @PareshMayani @joshuapinter @adrianbudzynski @martino2k6 @tzutalin |
Thanks! @joshuatam is working |
@joshuatam
what need i to do more? do you have an worked sample? |
@ImangazalievM do i need to change a lot if use ReActiveAndroid? |
@liupeng826 No. If you want to migrate to ReActiveAndroid, read this article https://imangazalievm.gitbooks.io/reactiveandroid/migration-from-activeandroid.html |
@joshuatam Your solution worked for me perfectly. Thanks! |
So what to do to solve this problem? I have never used ContentProvider for all classes but one class has already created the code but still gets the report error |
@fajaranugrah you can start using https://github.com/ImangazalievM/ReActiveAndroid. I fixed all bugs and it works on Android O. If you want to migrate to ReActiveAndroid, please read this article https://imangazalievm.gitbooks.io/reactiveandroid/migration-from-activeandroid.html |
@joshuatam Thank you for help! It's works perfectly. |
A nifty trick if you don't want to extend the This allows you to keep the normal ContentProvider as is in the <provider
android:name="com.activeandroid.content.ContentProvider"
android:authorities="${applicationId}"
android:enabled="true"
android:exported="false">
</provider> And then just do something like this in your App's // Close existing database connection, if it exists.
try {
ActiveAndroid.dispose();
}
catch( NullPointerException ignored ) {}
Configuration databaseConfiguration = new Configuration.Builder( this )
.setDatabaseName( "MyDatabase" )
.setDatabaseVersion( 100 )
.setModelClasses( MyModel.class )
.create();
ActiveAndroid.initialize( databaseConfiguration ); This does mean that you will have an |
I recently just updated my device to Android O and now the .save methods no longer work.
java.lang.SecurityException: Failed to find provider null for user 0; expected to find a valid ContentProvider for this authority at android.os.Parcel.readException(Parcel.java:1942) at android.os.Parcel.readException(Parcel.java:1888) at android.content.IContentService$Stub$Proxy.notifyChange(IContentService.java:801) at android.content.ContentResolver.notifyChange(ContentResolver.java:2046) at android.content.ContentResolver.notifyChange(ContentResolver.java:1997) at android.content.ContentResolver.notifyChange(ContentResolver.java:1967) at com.activeandroid.Model.save(Model.java:162)
The text was updated successfully, but these errors were encountered: