首页 > 解决方案 > 应用清单中的 URI 方案未正确设置

问题描述

我正在尝试连接我的 Dropbox,我不知道这个问题来自哪里,但我已经很好地编辑了清单文件!我做错了什么可以请任何人帮助我...

这是我的清单文件:

  <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.JurnalCloudApp">
        <activity
            android:name=".DropboxActivity"
            android:exported="true" />
        <activity
            android:name=".SyncActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.dropbox.core.android.AuthActivity"
            android:configChanges="orientation|keyboard"
            android:launchMode="singleTask">
            <intent-filter>

                <!-- Change this to be db- followed by your app key -->
                <data android:scheme="db-is9rikcfjhforcl" />

                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".MainActivity"
            android:exported="true"/>
    </application>

错误是:

Caused by: java.lang.IllegalStateException: URI scheme in your app's manifest is not set up correctly. You should have a com.dropbox.core.android.AuthActivity with the scheme: db-db-is9rstkcfjhlorcl

标签: androidschemamanifestdropbox-apidropbox-sdk

解决方案


你的data android:scheme样子是对的。根据错误消息,您似乎正在将“db-YOURAPPKEY”传递给启动应用程序授权流程startOAuth2PKCE的方法,而您应该只指定应用程序密钥,即“YOURAPPKEY”(没有“db- ”)。

如果您在代码中的应用程序密钥中包含该“db-”,SDK 将在您的清单中预期“db-db-is9rstkcfjhlorcl”(带有额外的“db-”),这是不正确的。


推荐阅读