找不到用户0的提供程序cz.martykan.forecastie.authority;期望为此授权机构找到有效的ContentProvider

时间:2019-07-16 21:06:55

标签: javascript android android-8.0-oreo android-securityexception

当我升级到oreo sdk 26时,出现一条错误消息,提示应该有一个有效的内容提供程序。我没有得到如何在我的图书馆中实现它的信息。

    [


public class DashClockWeatherExtension extends DashClockExtension {
    private static final Uri URI_BASE = Uri.parse("content://cz.martykan.forecastie.authority");
    private static final String UPDATE_URI_PATH_SEGMENT = "dashclock/update";  

public static void updateDashClock(Context context) {
        ContentResolver contentResolver = context.getContentResolver();
        contentResolver.notifyChange(getUpdateUri(), null);
    }

    private static Uri getUpdateUri() {
        return Uri.withAppendedPath(URI_BASE, UPDATE_URI_PATH_SEGMENT);
    }

]

以下异常

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: cz.martykan.forecastie, PID: 11139
    java.lang.SecurityException: Failed to find provider cz.martykan.forecastie.authority for user 0; expected to find a valid ContentProvider for this authority
        at android.os.Parcel.createException(Parcel.java:1942)
        at android.os.Parcel.readException(Parcel.java:1910)
        at android.os.Parcel.readException(Parcel.java:1860)
        at android.content.IContentService$Stub$Proxy.notifyChange(IContentService.java:812)
        at android.content.ContentResolver.notifyChange(ContentResolver.java:2096)
        at android.content.ContentResolver.notifyChange(ContentResolver.java:2047)
        at android.content.ContentResolver.notifyChange(ContentResolver.java:2017)
        at cz.martykan.forecastie.widgets.DashClockWeatherExtension.updateDashClock(DashClockWeatherExtension.java:85)
        at cz.martykan.forecastie.activities.MainActivity$TodayWeatherTask.onPostExecute(MainActivity.java:811)
        at cz.martykan.forecastie.activities.MainActivity$TodayWeatherTask.onPostExecute(MainActivity.java:795)

0 个答案:

没有答案