2016-05-17 92 views
0

任何人都可以請告訴我是什麼導致下面的錯誤?類被命名爲HomePage.cs並位於正確的目錄中。無法解決Android ClassNotFoundException

了java.lang.RuntimeException:無法實例活動ComponentInfo {App2.App2/App2.App2.HomePage}:拋出java.lang.ClassNotFoundException:找不到類 「App2.App2.HomePage」

HomePage.cs

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 


using Android.App; 
using Android.Content; 
using Android.OS; 
using Android.Runtime; 
using Android.Views; 
using Android.Widget; 

namespace App2 
{ 
    [Activity(Label = "HomePage")] 
    public class HomePage : Activity 
    { 
     protected override void OnCreate(Bundle savedInstanceState) 
     { 
      base.OnCreate(savedInstanceState); 
      SetContentView(Resource.Layout.home_page); 
     } 
} 

清單

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="App2.App2" android:versionCode="1" android:versionName="1.0"> 
    <uses-sdk android:minSdkVersion="16" /> 
    <application android:label="App2" android:debuggable="true"> 
     <activity android:name=".HomePage"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 
</manifest> 

回答

0

試試這個:

在清單文件中寫入活動的全名(包)。

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="App2.App2" android:versionCode="1" android:versionName="1.0"> 
<uses-sdk android:minSdkVersion="16" /> 
<application android:label="App2" android:debuggable="true"> 
    <activity android:name="App2.App2.HomePage"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application>