2016-01-05 74 views
2

而在Visual Studio 2015年調試我的代碼,我得到這個錯誤:未能加載程序集「Xamarin.Android.Support.v4」

嚴重性代碼說明項目文件行錯誤意外錯誤 - 請文件一個錯誤報告http://bugzilla.xamarin.com。原因: System.IO.FileNotFoundException:無法加載程序集 'Xamarin.Android.Support.v4,Version =,Culture = neutral, PublicKeyToken ='。也許它不存在於Mono for Android 個人資料? DTR_ACMS

我試着重新安裝Android Support Library v4。

我的代碼:

using System; 
using Android.App; 
using Android.Content; 
using Android.Runtime; 
using Android.Views; 
using Android.Widget; 
using Android.OS; 
using Android.Support.V4.App; 
using TaskStackBuilder = Android.Support.V4.App.TaskStackBuilder; 

namespace DTR_ACMS 
{ 
    [Activity(Label = "DTR_ACMS", MainLauncher = true, Icon = "@drawable/icon")] 
    public class MainActivity : Activity 
    { 
     int count = 1; 
     private static readonly int ButtonClickNotificationId = 1000; 
     private void ButtonOnClick(object sender, EventArgs eventArgs) 
     { 
      // Set up an intent so that tapping the notifications returns to this app: 
      Intent intent = new Intent(this, typeof(MainActivity)); 

      // Create a PendingIntent; we're only using one PendingIntent (ID = 0): 
      const int pendingIntentId = 0; 
      PendingIntent pendingIntent = 
       PendingIntent.GetActivity(this, pendingIntentId, intent, PendingIntentFlags.OneShot); 

      // Build the notification: 
      NotificationCompat.Builder builder = new NotificationCompat.Builder(this) 
       .SetAutoCancel(true)     // Dismiss from the notif. area when clicked 
       .SetContentTitle("Button Clicked")  // Set its title 
       .SetNumber(count)      // Display the count in the Content Info 
       .SetSmallIcon(Resource.Drawable.ic_stat_button_click) // Display this icon 
       .SetContentText(String.Format(
        "The button has been clicked {0} times.", count)); // The message to display. 

      // Finally, publish the notification: 
      NotificationManager notificationManager = 
       (NotificationManager)GetSystemService(Context.NotificationService); 
      notificationManager.Notify(ButtonClickNotificationId, builder.Build()); 

      // Increment the button press count: 
      count++; 
     } 

     protected override void OnCreate(Bundle bundle) 
     { 
      base.OnCreate(bundle); 

      // Set our view from the "main" layout resource 
      SetContentView(Resource.Layout.Main); 

      // Get our button from the layout resource, 
      // and attach an event to it 
      Button button = FindViewById<Button>(Resource.Id.button1); 

      button.Click += ButtonOnClick; 
     } 
    } 
} 

回答

相關問題