2016-09-10 34 views
-3

我想在我的應用程序中實現PDF查看器。無法找到活動,你有清單中聲明

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

<uses-sdk 
    android:minSdkVersion="14" 
    android:targetSdkVersion="18" /> 

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

<application 
    android:allowBackup="true" 
    android:icon="@drawable/logo1" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.example.ttech.SplashScreen" 
     android:label="@string/title_activity_splash_screen" 
     > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <activity 
     android:name="com.example.ttech.MainActivity" 
     android:label="@string/app_name" > 
    </activity> 
    <activity 
     android:name="com.example.ttech.NewLogin" 
     android:label="@string/title_activity_new_login" > 
    </activity> 
    <activity 
     android:name="com.example.ttech.HomePage" 
     android:label="@string/title_activity_home_page" > 
    </activity> 
    <activity 
     android:name="com.example.ttech.Audio" 
     android:label="@string/title_activity_audio" > 
    </activity> 
    <activity android:name=".PdfViewerActivity" 
     android:label="@string/title_activity_pdf_viewer" 
     > 
    </activity> 
    <activity 
     android:name="com.example.ttech.Feedback" 
     android:label="@string/title_activity_feedback" > 
    </activity> 
    <activity 
     android:name="com.example.ttech.Profile" 
     android:label="@string/title_activity_profile" > 
    </activity> 
    <activity 
     android:name="com.example.ttech.AboutUs" 
     android:label="@string/title_activity_about_us" > 
    </activity> 
    <activity 
     android:name="com.example.ttech.Contact" 
     android:label="@string/title_activity_contact" > 
    </activity> 
    <activity 
     android:name="com.example.ttech.LogOut" 
     android:label="@string/title_activity_log_out" > 
    </activity> 
    <activity 
     android:name="com.example.ttech.LoginActivity" 
     android:label="@string/title_activity_login" 
     > 
    </activity> 
</application> 

的錯誤是我得到的是: -

E/AndroidRuntime(828): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.ttech/net.sf.andpdf.pdfviewer.PdfViewerActivity}; have you declared this activity in your Android manifest 
+3

跟它活動烏爾試圖訪問你的manifest文件不聲明 –

+0

您還沒有宣佈你的觀衆活動定義活動。 – srinivas

回答

2

你宣佈活動作爲

<activity android:name=".PdfViewerActivity" 
    android:label="@string/title_activity_pdf_viewer" /> 

既然你定義package="com.example.ttech",活動分類com.example.ttech.PdfViewerActivity,但您想要使用net.sf.andpdf.pdfviewer.PdfViewerActivity

因此,你必須有一個絕對的包名

<activity android:name="net.sf.andpdf.pdfviewer.PdfViewerActivity" 
    android:label="@string/title_activity_pdf_viewer" /> 
+0

在聲明像這樣,我得到錯誤09-10 06:32:22.459:E/AndroidRuntime(843):致命例外:主 09-10 06:32:22.459:E/AndroidRuntime(843):java。 lang.RuntimeException:無法實例化活動ComponentInfo {com.example.ttech/net.sf.andpdf.pdfviewer.PdfViewerActivity}:java.lang.InstantiationException:無法實例化類net.sf.andpdf.pdfviewer.PdfViewerActivity – KiranB

+1

stacktrace告訴你這種例外的原因。不僅是信息。但它告訴我,至少你的第一個問題已經解決了...... – tynn

相關問題