Home>

The app cannot be executed.
I created a new project and pressed F5, but I got the following error:

Error message

Severity level code Description Project file line Suppressed state
Error ADB0000: couldn't create file: Permission denied
   Location Mono.AndroidTools.Util.AggregateAsyncResult.CheckError (CancellationToken token)
   Location Mono.AndroidTools.Adb.AdbSyncClient.EndPush (IAsyncResult result)
   Location System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic (IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization) 0
Applicable source code
<? xml version = "1.0" encoding = "utf-8"?>
<manifest xmlns: android = "http://schemas.android.com/apk/res/android"
          android: versionCode = "1"
          android: versionName = "1.0"
          package = "MyTestProject.MyTestProject">
  <uses-sdk android: minSdkVersion = "21" android: targetSdkVersion = "27" />
  <application android: allowBackup = "true" android: icon = "@ mipmap/ic_launcher" android: label = "@ string/app_name" android: roundIcon = "@ mipmap/ic_launcher_round" android: supportsRtl = "true" android: theme = "@ style/AppTheme">
  </application>
</manifest>
using System;
using Android.App;
using Android.OS;
using Android.Runtime;
using Android.Support.Design.Widget;
using Android.Support.V7.App;
using Android.Views;
using Android.Widget;
namespace MyTestProject
{
    [Activity (Label = "@ string/app_name", Theme = "@ style/AppTheme.NoActionBar", MainLauncher = true)]
    public class MainActivity: AppCompatActivity
    {
        protected override void OnCreate (Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);
            SetContentView (Resource.Layout.activity_main);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar (toolbar);
            FloatingActionButton fab = FindViewById<FloatingActionButton>(Resource.Id.fab);
            fab.Click + = FabOnClick;
        }
        public override bool OnCreateOptionsMenu (IMenu menu)
        {
            MenuInflater.Inflate (Resource.Menu.menu_main, menu);
            return true;
        }
        public override bool OnOptionsItemSelected (IMenuItem item)
        {
            int id = item.ItemId;
            if (id == Resource.Id.action_settings)
            {
                return true;
            }
            return base.OnOptionsItemSelected (item);
        }
        private void FabOnClick (object sender, EventArgs eventArgs)
        {
            View view = (View) sender;
            Snackbar.Make (view, "Replace with your own action", Snackbar.LengthLong)
                .SetAction ("Action", (Android.Views.View.IOnClickListener) null) .Show ();
        }
    }
}
Tried
  • Switch between Debug and Release
    Both gave the same error

  • Use Ctrl + F5, F5
    Both gave the same error

  • Direct installation of MyTestProject-Signed.apk in bin/Release
    adb install MyTestProject-Signed.apk
    I was able to execute it. However, it takes time to execute the command every time.

Supplemental information (FW/tool version etc.)
  • VisualStudio 2017 Community
  • Xamarin.Android SDK 9.0.0.18