2013-02-15 66 views
0

我正試圖將this庫導入到我的Android項目中。在this link描述的和做的使用情況1.將庫導入到Android項目

在logcat中我得到這個我正好做:

02-15 08:49:09.860: E/AndroidRuntime(6936): FATAL EXCEPTION: main 
02-15 08:49:09.860: E/AndroidRuntime(6936): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.projectname/com.codinguser.android.contactpicker.ContactsPickerActivity}; have you declared this activity in your AndroidManifest.xml? 
02-15 08:49:09.860: E/AndroidRuntime(6936):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405) 
... 

我已經嘗試過加入ContactsPickerActivity活動在AndroidManifest.xml中,但我仍然得到錯誤。

的AndroidManifest.xml:

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

    <uses-sdk android:minSdkVersion="10" 
       android:targetSdkVersion="17" /> 

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

    <application android:allowBackup="true" 
       android:icon="@drawable/ic_launcher" 
       android:label="@string/app_name" 
       android:theme="@style/AppTheme" > 

     <activity android:name="com.example.projectname.MainActivity" 
        android:label="@string/app_name" 
        android:uiOptions="splitActionBarWhenNarrow" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

     <activity android:name="com.example.projectname.NewTemplateActivity" 
        android:label="@string/app_name" > 
     </activity> 

     <provider android:name="com.example.projectname.DataProvider" 
        android:authorities="com.example.projectname.dataprovider" 
        android:exported="false" >" 
     </provider> 

     <receiver android:name="com.example.projectname.SentReceiver" 
        android:enabled="true" 
        android:exported="false" > 
      <intent-filter> 
       <action android:name="com.example.projectname.MainActivity.SMS_SENT_ACTION" /> 
      </intent-filter> 
     </receiver> 

    </application> 

</manifest> 

我這樣做呼叫:

startActivityForResult(new Intent(getActivity(), ContactsPickerActivity.class), GET_PHONE_NUMBER); 

在MainActivity的片段。

如果有人能指導我我做錯了什麼,我將不勝感激。謝謝。

+2

發表您的AndroidManifest.xml – Clyde 2013-02-15 10:59:10

+0

更新與AndroidManifest職。 – 2013-02-15 11:04:27

+1

你說你已將所需的活動條目添加到清單中 - 但我沒有看到它。 (你需要它) – Elemental 2013-02-15 11:16:39

回答

0

已解決。

我錯過了我的AndroidManifest.xml如下:

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

<activity android:name="com.codinguser.android.contactpicker.ContactsPickerActivity" 
        android:label="@string/app_name" > 
</activity> 
相關問題