所以Android清单验证错误,我试图使用内置的联系人选择器在我的Android应用程序,但我得到了这条线以下错误:与使用的权限
cursor = getContext().getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ id,null, null);
错误:
Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/data/phones from pid=11135, uid=10057 requires android.permission.READ_CONTACTS, or grantUriPermission()
所以,我想我必须添加使用许可权在我的AndroidManifest.xml像这样(这是我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="balevski.meetme" >
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
因此,我在添加READ_CONTACTS权限后重建了我的项目,但仍然遇到同样的问题。
接下来,我验证了我AndroidManifest.xml文件,并显示以下错误:
C:\Users\dbale\AndroidStudioProjects\MeetMe\app\src\main\AndroidManifest.xml
Error:(2, 97) cvc-elt.1: Cannot find the declaration of element 'manifest'.
Error:(1, 56) s4s-elt-schema-ns: The namespace of element 'x' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.
Error:(1, 56) s4s-elt-invalid: Element 'x' is not a valid element in a schema document.
Error:(1, 56) schema_reference.4: Failed to read schema document 'null', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
这里是我的摇篮的应用程序文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "balevski.meetme"
minSdkVersion 7
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
}
我是新android的工作室,如果有人可以帮我弄清楚这个问题!
非常感谢。
清理项目,并重建它 –
我试图清理和重建。还是行不通。 – Borovez
'我使用w3schools xml验证器验证了我的AndroidManifest.xml文件?是啊没有必要这样做,我并不感到惊讶它失败了,不用担心这个 – Blundell