错误-未找到属性“android:testOnly”

错误-未找到属性“android:testOnly”,android,android-studio,sdk,runtime,dropbox,Android,Android Studio,Sdk,Runtime,Dropbox,我正在尝试在DropBox Android SDK中运行示例dbRoulete: 当我在Android Studio build->Rebuild项目中构建项目时,我没有收到任何错误,但当我试图从Android Studio在我的设备上运行代码时,我收到错误: 未找到属性“android:testOnly” 我可以看到这句话: android:testOnly="true" 在AndroidManifest.xml文件中,但据我所知,我无法编辑此文件并将其更改为testOnly=false 有

我正在尝试在DropBox Android SDK中运行示例dbRoulete:

当我在Android Studio build->Rebuild项目中构建项目时,我没有收到任何错误,但当我试图从Android Studio在我的设备上运行代码时,我收到错误:

未找到属性“android:testOnly”

我可以看到这句话:

android:testOnly="true"
在AndroidManifest.xml文件中,但据我所知,我无法编辑此文件并将其更改为testOnly=false

有什么问题?为什么我会犯这个错误

如果重要的话,我用的是Gradle-4.5.1

下面是我得到的完整构建消息:

Information:Gradle tasks [:app:assembleDebug]
D:\AndroidProjects\DropboxSDK-1.6.3\DBRouletteTest\app\build\intermediates\manifests\instant-run\debug\AndroidManifest.xml
Error:(12) error: attribute 'android:testOnly' not found.
Error:(12) attribute 'android:testOnly' not found.
Error:failed processing manifest.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Information:BUILD FAILED in 0s
Information:6 errors
Information:0 warnings
Information:See complete output in console
以下是AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.dropbox.android.sample"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="3" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:debuggable="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:testOnly="true" >
        <activity
            android:name="com.dropbox.android.sample.DBRoulette"
            android:configChanges="orientation|keyboard"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.dropbox.client2.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-CHANGE_ME" />

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

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

        <provider
            android:name="com.android.tools.ir.server.InstantRunContentProvider"
            android:authorities="com.dropbox.android.sample.com.android.tools.ir.server.InstantRunContentProvider"
            android:multiprocess="true" />
    </application>

</manifest>

也许是我想的。最后,我通过执行以下操作成功启动了该应用程序:

复制我的AndroidManifest.xml并输入密钥。 在dbroulete.class中添加密钥和密码。 在build.gradleModule:app文件中,将最小sdk从3更改为4

这对我来说很有效,因为根据android Studio的警告,android:testOnly功能在API 3中不可用 如果我告诉您的是API 3产生的问题,请将此标记为正确来结束问题,否则请解释进一步的问题

我的舱单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dropbox.android.sample"
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="3" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission     android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application android:icon="@drawable/icon"
    android:label="@string/app_name">
    <activity
        android:name=".DBRoulette"
        android:label="@string/app_name"
        android:configChanges="orientation|keyboard">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name="com.dropbox.client2.android.AuthActivity"
        android:launchMode="singleTask"
        android:configChanges="orientation|keyboard">
        <intent-filter>
            <!-- Change this to be db- followed by your app key -->
            <data android:scheme="db-YOUR_TOKEN" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE"/>
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

</application>
</manifest>

在build.gradle中将compileSdkVersion更改为更高版本。我把compileSdkVersion改为28,它可以正常工作

好的,我按照您的要求添加了AndroidManifest.xml文件,这有帮助吗?我尝试了您的AndroidManifest.xml文件,我将其更改为我的应用程序密钥,但仍然存在相同的错误。我尝试手动重新添加它,我尝试删除此行,我还尝试将值更改为false。在所有情况下,Rebuid项目都是正常的,没有任何错误,但是当我尝试运行它时,我得到了错误,testOnly=true再次出现,并进行了一些修改。您使用的是Api v1还是最新版本?顺便说一句,与问题本身无关,根据顶部的警告,该示例应用程序适用于Dropbox Api v1,该版本现已退役。你应该改为使用。还有。