更改包名称后打开提供程序拒绝

时间:2019-03-24 19:28:50

标签: android sqlite

因此,在更改程序包名称后,我遇到了这个问题,这是我以前从未遇到过的。

2019-03-24 21:23:58.308 28082-28082/theodosios.tziomakas.news E/AndroidRuntime: FATAL EXCEPTION: main
    Process: theodosios.tziomakas.news, PID: 28082
    java.lang.RuntimeException: Unable to start activity ComponentInfo{theodosios.tziomakas.news/theodosios.tziomakas.news.DetailActivity}: java.lang.SecurityException: Permission Denial: opening provider theo.tziomakas.news.data.FavouriteProvider from ProcessRecord{bae498f 28082:theodosios.tziomakas.news/u0a104} (pid=28082, uid=10104) that is not exported from UID 10100
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.SecurityException: Permission Denial: opening provider theo.tziomakas.news.data.FavouriteProvider from ProcessRecord{bae498f 28082:theodosios.tziomakas.news/u0a104} (pid=28082, uid=10104) that is not exported from UID 10100
        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.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:4181)
        at android.app.ActivityThread.acquireProvider(ActivityThread.java:5970)
        at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2592)
        at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1828)
        at android.content.ContentResolver.query(ContentResolver.java:786)
        at android.content.ContentResolver.query(ContentResolver.java:752)
        at android.content.ContentResolver.query(ContentResolver.java:710)
        at theodosios.tziomakas.news.DetailActivity.onCreate(DetailActivity.java:156)
        at android.app.Activity.performCreate(Activity.java:7136)
        at android.app.Activity.performCreate(Activity.java:7127)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
     Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.am.ActivityManagerService.getContentProviderImpl(ActivityManagerService.java:12303)
        at com.android.server.am.ActivityManagerService.getContentProvider(ActivityManagerService.java:12585)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:357)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3291)
        at android.os.Binder.execTransact(Binder.java:731)

这是我的manifest.xml文件。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="theodosios.tziomakas.news">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher_foreground"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name="theodosios.tziomakas.news.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data android:name="firebase_analytics_collection_enabled" android:value="false" />
        <activity android:name="theodosios.tziomakas.news.StartActivity"
            />
        <activity
            android:name="theodosios.tziomakas.news.RegisterActivity"
            android:parentActivityName="theodosios.tziomakas.news.StartActivity" />
        <activity
            android:name="theodosios.tziomakas.news.LoginActivity"
            android:parentActivityName="theodosios.tziomakas.news.StartActivity" />
        <activity
            android:name="theodosios.tziomakas.news.ForgotPasswordActivity"
            android:parentActivityName="theodosios.tziomakas.news.LoginActivity" />

        <receiver android:name="theodosios.tziomakas.news.widget.NewsAppWidgetProvider">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/news_app_widget_info" />
        </receiver>





        <service android:name="theodosios.tziomakas.news.widget.UpdateNewsWidgetService" />
        <service
            android:name="theodosios.tziomakas.news.widget.GridWidgetService"
            android:permission="android.permission.BIND_REMOTEVIEWS" />

        <activity
            android:name="theodosios.tziomakas.news.DetailActivity"
            android:parentActivityName="theodosios.tziomakas.news.MainActivity" />

        <provider
            android:name=".data.FavouriteProvider"
            android:authorities="theodosios.tziomakas.news"
            android:exported="true"
            android:readPermission=".data.FavouriteProvider.READ_DATABASE"
            android:writePermission=".news.data.FavouriteProvider.WRITE_DATABASE"/>

        <activity
            android:name="theodosios.tziomakas.news.FavouriteNewsActivity"
            android:parentActivityName="theodosios.tziomakas.news.MainActivity" />
        <activity android:name="theodosios.tziomakas.news.CommentActivity" />
    </application>

</manifest>

我也一直在看这个link,但没有结果。

如何解决该异常?

谢谢 西奥。

已修复

我使用了错误的权限。

theo.tziomakas.news 。它应该是 theodosios.tziomakas.news

0 个答案:

没有答案