Only the original thread that created a view hierarchy can touch its views Xamarin forms

Exception: Only the original thread that created a view hierarchy can touch its views

January 13, 2015, 6:03 am

The code below works on Windows Phone but when running on Android I am getting the following exception : android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.

public ButtonLoggerPage() { // Create the Button and attach Clicked handler. Button button = new Button { Text = "Log the Click Time" }; button.Clicked += OnButtonClicked; opusClient.LoginCheckCompleted += OpenReadLogincheck; this.Padding = new Thickness(5, Device.OnPlatform(20, 0, 0), 5, 0); tbSyncItemLbl = new Label { }; // Assemble the page. this.Content = new StackLayout { Children = { button,new ScrollView { VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Gray, Content = loggerLayout} } }; } void OnButtonClicked(object sender, EventArgs args) { loginCheck(); } public void loginCheck() { try { client.LoginCheckAsync(username, password); } catch (Exception e) { receiveErrors = 22; } } void OpenReadLogincheck(Object sender, LoginCheckCompletedEventArgs e) { if (e.Result != null) { LoginStatus = e.Result.Value; if (e.Result == 1) { addMessage("Login Succeeded", Direction.Download); }

}
}

public enum Direction { Upload, Download, DownloadFailed, UploadFailed }; public void setSyncItem(string itemName, Direction dir) { tbSyncItemLbl.Text += itemName +" " + Environment.NewLine; if (dir == Direction.Download) { this.tbSyncItemLbl.TextColor = Color.FromHex("B5DF26"); } else if (dir == Direction.Upload) { this.tbSyncItemLbl.TextColor = Color.FromHex("527EA5"); } else if (dir == Direction.DownloadFailed) { this.tbSyncItemLbl.TextColor = Color.FromHex("FF0000"); } else if (dir == Direction.UploadFailed) { this.tbSyncItemLbl.TextColor = Color.FromHex("FF0000"); } this.tbSyncItemLbl.YAlign = TextAlignment.Center; } private void addMessage(string item, Direction dir) { setSyncItem(item, dir); loggerLayout.Children.Add(tbSyncItemLbl); } Label tbSyncItemLbl ;


Only the original thread that created a view hierarchy can touch its views.

February 20, 2019, 10:53 am

Hi there! First of all, my english is not very well, so please be patient to read my question slowly.

Well, as you can see on the tittle, I got a problem about threads. I'm using a Listview and trying to binding the ItemSource from a viewmodel loaded with data (I'm trying to do something like a timeline using facebook or instagram as example). The case is... when I try to use "Binding" I got this Error Message:

"Unhandled Exception:
Android.Util.AndroidRuntimeException: Only the original thread that created a view hierarchy can touch its views."

Yeah, I know this question has been answered in another threads in the forum with the following code:
"Device.BeginInvokeOnMainThread(() => { NotifyPropertyChanged( nameof(PropertyName) ); });"

But that line is the one that makes de app get into a Break Mode. So... any idea?

Thanks for read.

Android.Util.AndroidRunTimeException:Only the original thread created a view hierarchy

September 26, 2017, 7:44 am

It Seems to happen more often on Go Back or going back using Logout button which has almost similar implementations, and If I try to login again.
but it has happened on normal modal navigation as well. I have tried wrapping the navigation service calls in Device.BeginInvokeOnMainThread(),
but it didn't help me at all. It's a random navigation service crash and totally weird

//Login Method private async void LoginMethod() { try { if (CrossConnectivity.Current.IsConnected) { if (!String.IsNullOrEmpty(usernameEntry.Text) && !String.IsNullOrEmpty(passwordEntry.Text)) { this.activityIndicator.IsRunning = true; this.loading.IsVisible = true; string username = usernameEntry.Text; string password = passwordEntry.Text; LoginToken login = await Core.GetLoginData(username, password); if (login != null) { App.IsUserLoggedIn = true; //await DisplayAlert("Login", "Login Successful", "Ok"); if (Device.RuntimePlatform == Device.iOS) { await Navigation.PopToRootAsync(); //Application.Current.MainPage = new MainPage(); Device.BeginInvokeOnMainThread(NextAsyncMethod); } else if(Device.RuntimePlatform == Device.Android) { this.activityIndicator.IsRunning = false; this.loading.IsVisible = false; Device.BeginInvokeOnMainThread(NextAsyncMethod); } } else { passwordEntry.Text = string.Empty; this.activityIndicator.IsRunning = false; this.loading.IsVisible = false; await DisplayAlert("Login", "Login Failed", "Ok"); } } else { this.activityIndicator.IsRunning = false; this.loading.IsVisible = false; await DisplayAlert("Login", "Please Put Credentials", "Ok"); } } else { await DisplayAlert("Login", "Please Connect to internet", "Ok"); } } catch (Exception e) // handle whatever exceptions you expect { //Handle exceptions System.Diagnostics.Debug.WriteLine(e); } } //Method for main page navigation private void NextAsyncMethod() { Navigation.PushModalAsync(new MainPage(OnLoginButtonClicked)); } **//Main page is a masterDetail page which loads a first view where mainly it crashes loading the data dynamically** private async void GetTankData() { try { customer = await Core.GetCustomerData(App.AppToken); if (customer != null) { new System.Threading.Thread(new System.Threading.ThreadStart(() => { Device.BeginInvokeOnMainThread(async () => { await Task.Delay(3000); var pages = new ObservableCollection<CarouselContent>(); foreach (var value in customer.Tanks) { var page = new CarouselContent(); page.Header = value["materialName"].ToString(); pages.Add(page); } var carouselView = new Carousel(pages, customer, transLabel, materialId, progressLabel); Cr.Children.Add(carouselView); }); })).Start(); } else { await DisplayAlert("Message", "No Data Found", "ok"); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); await DisplayAlert("Message", ex.ToString(), "ok"); } } //Logout method code parts if (item.Title == "Logout") { Device.BeginInvokeOnMainThread(async () => { var result = await this.DisplayAlert("Message!", "Do you really want to Logout?", "Yes", "No"); if (result) { Device.BeginInvokeOnMainThread(NextMethod); CrossDeviceMotion.Current.Stop(MotionSensorType.Accelerometer); // or anything else } }); } private void NextMethod() { try { NextAsyncMethod(); } catch (Exception ex) // handle whatever exceptions you expect { System.Diagnostics.Debug.WriteLine(ex); //Handle exceptions } } private void NextAsyncMethod() { Navigation.PopModalAsync(); Device.BeginInvokeOnMainThread(() => { App.IsUserLoggedIn = false; BtnLogin.IsEnabled = true; Navigation.PushModalAsync(new Login()); }); } protected override bool OnBackButtonPressed() { Device.BeginInvokeOnMainThread(async () => { var result = await DisplayAlert("Message!", "Do you really want to exit?", "Yes", "No"); if (result) await Navigation.PopModalAsync(); // or anything else }); return true; }

I tried to find solution for this but this unexpected error has very less talk.. however I have found a relevant post where it was closed as a xamarin forms problem. Please any help in this matter will be appreciated. Really stuck on that.

Xamarin Essentials- IOS not restore the preferences if the app ruining in background is kiiled

April 12, 2019, 1:01 am

I used Preferences API for saving the user credentials on both iOS and Android. It worked correctly but after updating Xamarin Essentials to the version 1.1.0, the user credentials can not be restored on the iOS device. If I close the app (but it is still running in the background ) the user credentials are restored correctly.
The problem happens when I kill the app running in the background. Then, I need to insert the username and password again when I reopen it.
Although, the Android version of my app works correctly and it can restore user credentials thanks to preferences API.

IDE: Visual Studio 8.0.2 (.netstandard 2.0)
iOS: The values have not been stored on iOS devices since I update the Xamarin Essentials. (ios version: 12.1.4 - iPhone 5)
Android: Preferences API works correctly.
Xamarin Forms: 3.4.0

All references broken after moving project to another computer

June 28, 2018, 2:35 pm

After moving computers, all the references are missing. I tried using NuGet package restore but it just said 0 packages to restore. I tried uninstalling and reinstalling all the packages. I tried updating the packages. Even packages that weren't installed before show up with the yellow triangle after being installed. I also tried manually adding the references by pointing to the .dll files but the references still show up with yellow triangles. Please help!

Thank you in advance.

Touch event on a control under a Transparent Grid

April 14, 2019, 11:57 pm

Hi all,

I have a Relative layout like this.

  1. Google Map full screen
  2. Grid with full screen (BackgroundColor="Transparent"), inside this grid, I have a stacklayout and I set VerticalOptions="End". This also means my control box is always at the bottom of the screen and the google map is behind. Remember my control box height is dynamic. Not fixed

My issue is I want to zoom, drag the google map. But the Grid has a bigger z-index (althought it's Transparent) so I could not touch any event to my google map.

If I set InputTransparent="True" to grid. I can touch the google map but I cannot touch to my control box...

Do you have any suggestion with that kind of layout?

Thank you so much,

How I can enable auto login in UIWEBVIEW

April 13, 2019, 8:32 am

hello,
I am new to xamarin and trying to create simple webview application ..

and I went to enable auto login is user make a success login i.e " save login information "

public void prepare_webview() { main_web_view.ScrollView.Bounces = false; //Disable Zoom main_web_view.MultipleTouchEnabled = false; main_web_view.ScalesPageToFit = false; //Set User Agent var dictionary = NSDictionary.FromObjectsAndKeys(new[] { "Android" }, new[] { "UserAgent" }); NSUserDefaults.StandardUserDefaults.RegisterDefaults(dictionary); // Enable Cache NSUrlCache.SharedCache = new NSUrlCache(4 * 1024 * 1024, 20 * 1024 * 1024, "webcache"); NSHttpCookieStorage.SharedStorage.AcceptPolicy = NSHttpCookieAcceptPolicy.Always; // Load Site main_web_view.LoadRequest(new NSUrlRequest(new NSUrl(url)));

}

Nlog configuration file not getting loaded

April 3, 2019, 3:56 am

Below stmt
NLog.LogManager.Configuration = new XmlLoggingConfiguration("assets//NLog.config",true);
gives me following error:
The name 'new XmlLoggingConfiguration("assets\NLog.config")' does not exist in the current context.
which in turn throws exception
System.NullReferenceException: Object reference not set to an instance of an object.

I tried passing file name in all ways i could think of.

Also can anyone explain me does the above statement is used to log error in that file or that its just rules that are to be followed in the file? Do i have to create a new file where everything gets logged in?

Thanks,


Can someone from Xamarin please, please take a look at the developing for the Apple Watch?

October 18, 2018, 1:34 am

I hate to be so negative but, having spent literally weeks trying to get a Xamarin application to deploy to a physical Apple Watch, I believe that this is not currently possible. To speak even more frankly, I think this 'feature' should either be removed from Xamarin or properly supported.

For over a year, I have been working around various Xamarin foibles on a new tech startup project that is literally the difference between my having a future and not. So, when I chose to put my faith in Xamarin, the stakes could not have been higher.

Initially, I paid the full whack for a Xamarin licence. Both before and after Microsoft bought Xamarin, I have generally been satisfied with the support I have received, both here on this forum and from Xamarin. But the Apple Watch support is a different story. To be fair, I have received help from various people with this, but the fact remains that here I am, six months after first looking into the Apple Watch on Xamarin, with my whole project and future dead in the water.

I have followed every single guide and troubleshooter out there. I just cannot get a Xamarin application to go on to a physical Apple Watch. I managed it just once. I even hit a breakpoint in the debugger on the PC! I thought, "Great! Now I can begin work tomorrow morning." The following morning, without touching a line of code or a single setting, the whole thing was broken again. And I have never got it going since that day, which was about two months ago now.

Generally, I remain impressed by Xamarin, but , please, please, please can someone take a look at the deployment of code on to a physical Apple Watch? It is unusable as it stands. And therefore, as it stands, my new business doesn't have a chance and I am forced to admit that my time might have been better spent simply learning to use XCode on the Mac.

Yours desperately - A Loyal Xamarin Developer

An error occurred trying to load the page. Index was outside the bounds of the array.

April 12, 2019, 12:09 am

I'm building a mobile application using Xamarin Form.When I tried to open AndroidManifest.xml in Visual Studio 2019 Community by Right Click -> Xamarin.Android Project -> Properties -> Android Manifest , I'm getting following error,

"An error occurred trying to load the page. Index was outside the bounds of the array."

But the application is working perfectly, just does not show the Android Manifest in properties.

I have try recreate the Android Manifest again and replace the old Manifest in Xamarin.Android but it still does not resolve the problem. I have delete bin and obj file of Xamarin.Android but still problem persist. I have create another new Xamarin Form and try to read the AndroidManifest.xml from properties and I can read it. But It just does not show in Xamarin Form my project

1. I have check the Xamarin Log in Visual studio by going too Help -> Xamarin -> Open Logs . It do show some error log.

Can anyone help me regrading this problem. I have attached the Xamarin Log regarding the problem and include the Android Manifest

Android Manifest

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0.0" package="com.companyname.VMS.ResidentMobileApp" android:installLocation="preferExternal"> <application> <provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data> </provider> </application> <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="26" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.CAMERA" /> <application android:label="VMS.ResidentMobileApp.Android"></application> </manifest>

Change a source of image in a controltemplate

April 1, 2019, 12:53 am

Hi everyone,

I'm starting with Xamarin and I didn't find how to change a source of image in controltemplate. I want to change the image when the Wi-Fi state change.
I didn't use the MVVM model.
I attach my code of my controltemplate in App.xaml.

<ControlTemplate x:Key="State"> <Grid ColumnSpacing="0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="11*"/> </Grid.ColumnDefinitions>

<BoxView Grid.Column="0" Style="{DynamicResource boxviewStyle}"/> <ContentPresenter Grid.Column="1" /> <Grid Grid.Column="0"> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Button x:Name="ButtonHome" Grid.Column="0" Grid.Row="0" Style="{DynamicResource buttonStyle}" Image="home_48x46.png" Clicked="onClickedButtonHome"/> <Label x:Name="LabelBattery" Grid.Column="0" Grid.Row="1" Style="{DynamicResource labelStyle}" TextColor="White" Text="100 %" VerticalOptions="Center" HorizontalOptions="Start" Margin="5"/> <Image x:Name="Battery" Grid.Column="0" Grid.Row="1" Source="battery_icon_100_40px.png" VerticalOptions="Center" HorizontalOptions="End" Margin="5"/> <Label x:Name="LabelTime" Grid.Column="0" Grid.Row="2" Style="{DynamicResource labelStyle}" HorizontalOptions="Center" Text="08:35"/> <Button x:Name="ButtonGPS" Grid.Column="0" Grid.Row="3" Style="{DynamicResource buttonStyle}" Image="gps_icon_pos_70px.png" Clicked="onClickedButtonGPS"/> <Image x:Name="ImageWIFI" Grid.Column="0" Grid.Row="4" Source="wifi_off_70px.png" HorizontalOptions="Center"/> <Button x:Name="ButtonMore" Grid.Column="0" Grid.Row="6" Style="{DynamicResource buttonStyle}" Image="trois_points_70px.png" Clicked="onClickedButtonMore"/> </Grid> </Grid> </ControlTemplate>`

Thank you very much,

Is there a tool that converts UWP/Windows 10 XAML to Xamarin Forms XAML?

April 13, 2019, 6:21 am

I have developed some apps that run on UWP. Now I want to convert them to Xamarin Forms since Windows 10 mobile is pretty much dead.
As far as I know there are quite a lot of differences between Windows 10 XAML and Xamarin Forms XAML. For example, StackPanel (on UWP) vs StackLayout (on Xamarin Forms)

Is there a tool that can convert UWP XAML to Xamarin Forms XAML?

Incompatible iOS versions 12.4 12.8

April 13, 2019, 1:08 am

Ive got VS 2017 (15.9.11) running on my win 10 pc and have been happily connecting with a mac which has VS
recently I upgraded the Mac to a machine which could run Mojave and therefore latest ver of xcode
the VS on the mac is 8.02
When trying to connect to the Mac I get the message that the version of iOs on the Mac is incompatible with the one on the Win10 machine. This (as I have read) is an issue which has popped up several times in the past (I can find references to xamarin .iOS 11 but a) none of the suggestions are helpful and b) do not refer to these version) There is ver 12.4 (x.iOS) on the Win 10 and ver 12.8 (x.iOS) on the Mac. Therefore it wont let me connect to the Mac. It offers to 'downgrade' the Mac but previous posts seem to say that this messes things up.
Is there anyway of getting 12.8 on the Win10 machine rather than downgrading the Mac?
I have upgraded to the latest v Xam.Forms (even tried the prerelease but this does not install Xam.iOS 12.8) on the Win10 machine

Is the only answer to reinstall VS for Mac ? If so how to prevent it updating to 12.8?

Is the only answer to keep the two separate and just transfer the project when I want to build for iOS?
(therefore the useful 'connect to Mac' is useless)

Any suggestions gratefully received !
JM

Set a Picker.SelectedItem on page startup

April 12, 2019, 3:11 am

I have this piece of code

<Picker x:Name="CategoryPicker" ItemsSource="{Binding Categories, Mode=TwoWay}" SelectedItem="{Binding Path= RequestItem.Category, Mode=TwoWay}" HorizontalOptions="FillAndExpand" Title="Escolha uma Categoria" SelectedIndexChanged="OnSelectedIndexChanged" ItemDisplayBinding="{Binding Name}" Margin="10,20,10,0">

I'm saving an item, and when I save it, it goes to a list of items... If I want to change one of those items, I need to set the picker to the value stored in RequestItem.Category...
Since I'm binding the SelectedItem property It should automaticaly set the value of it rigth?

I've also tryed to do this on my Page constructor with this
CategoryPicker.SelectedItem = estimate?.Category;
and this
CategoryPicker.SelectedIndex = 0;
If I set a breakpoint rigth after this, CategoryPicker.SelectedIndex is equal to -1... It doesn't change to 0...

None of those seems to work... What am I doing wrong?

Xamarin Android support.V7 and V4 Breaking the VS2017 design view in V28.xx

April 12, 2019, 1:23 pm

Hi All

I updated my App to V28, now the design view is full of red error patches.

I tried to delete an reinstall packages to no result.

I tried a basic template with V27 and it works, and design view works

V28 appears to have broken up the few V7 and v4 support nugets into multiple inter dependent nugets which have to be uninstalled inthe right sequence, so now I am going back and forth trying to revert to v27

Please fix this

Cheers


App crashed on clicking entry fielding in android oreo 8.1

April 10, 2019, 10:12 pm

[0:] [Info][MenuSelectionPageViewModel] Closed
04-11 10:36:41.568 D/ViewRootImpl@bc9e929MainActivity: ViewPostIme pointer 0
04-11 10:36:41.604 D/ViewRootImpl@bc9e929MainActivity: ViewPostIme pointer 1
04-11 10:36:41.607 D/AbsListView( 3594): onTouchUp() mTouchMode : 0
04-11 10:36:41.764 W/zygote64( 3594): JNI RegisterNativeMethods: attempt to register 0 native methods for md51558244f76c53b6aeda52c8a337f2c37.EntryRenderer
04-11 10:36:42.617 D/ViewRootImpl@bc9e929MainActivity: ViewPostIme pointer 0
04-11 10:36:42.660 D/ViewRootImpl@bc9e929MainActivity: ViewPostIme pointer 1
04-11 10:36:42.714 V/InputMethodManager( 3594): Starting input: tba=android.view.inputmethod.EditorInfo@4f29930 nm : Kefi.Kefi ic=com.android.internal.widget.EditableInputConnection@11809a9
04-11 10:36:42.714 D/InputMethodManager( 3594): startInputInner - Id : 0
04-11 10:36:42.715 I/InputMethodManager( 3594): startInputInner - mService.startInputOrWindowGainedFocus
04-11 10:36:42.716 D/InputTransport( 3594): Input channel constructed: fd=95
04-11 10:36:42.717 D/InputTransport( 3594): Input channel destroyed: fd=90
04-11 10:36:42.717 D/InputMethodManager( 3594): SSI - flag : 0 Pid : 3594 view : Kefi.Kefi
04-11 10:36:42.756 D/InputTransport( 3594): Input channel constructed: fd=99
04-11 10:36:42.757 D/ViewRootImpl@f8644e1PopupWindow:9656c3a: setView = android.widget.PopupWindow$PopupDecorView{c2e1206 V.E...... ......I. 0,0-0,0} TM=true MM=false
04-11 10:36:42.776 D/ViewRootImpl@f8644e1PopupWindow:9656c3a: dispatchAttachedToWindow
04-11 10:36:42.799 V/Surface ( 3594): sf_framedrop debug : 0x4f4c, game : false, logging : 0
04-11 10:36:42.800 D/ViewRootImpl@f8644e1PopupWindow:9656c3a: Relayout returned: old=[0,0][0,0] new=[356,756][436,851] result=0x7 surface={valid=true 528423280640} changed=true
04-11 10:36:42.803 D/mali_winsys( 3594): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000, [80x95]-format:1
04-11 10:36:42.803 D/OpenGLRenderer( 3594): eglCreateWindowSurface = 0x7b0876d580, 0x7b087b6010
04-11 10:36:42.822 D/ViewRootImpl@f8644e1PopupWindow:9656c3a: MSG_RESIZED_REPORT: frame=Rect(356, 756 - 436, 851) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
04-11 10:36:42.965 D/ViewRootImpl@bc9e929MainActivity: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2340) ci=Rect(0, 85 - 0, 126) vi=Rect(0, 85 - 0, 939) or=1
Unhandled Exception:

System.NullReferenceException: Object reference not set to an instance of an object.

Mono.AndroidTools.SdkNotSupportedException when trying to deploy to emulator

April 7, 2019, 6:50 pm

I just installed VS2019 Mac. I have a Xamarin.Forms project that runs under Android. I right-click and select Options, and have the following options set:

  • General | Target Framework: Android 9.0 (Pie)
  • Android Application | Minimum Android version: Android 5.0 (API level 21)
  • Android Application | Target Android version: Android 9.0 (API level 28)

I select the Android project and this emulator that got created for me during VS install: Android_Accelerated_Nougat (API 25) and select the Play icon to deploy and debug the application on this emulator. During deploy, I end up with the exception below. Any ideas on how best to debug this. Any good, basic reference links would be welcome too, as this is the first time we're targeting Android.

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000: Deployment failed /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000: Xamarin.AndroidTools.AndroidDeploymentException: SdkNotSupportedByDevice ---> Mono.AndroidTools.SdkNotSupportedException: The device does not support the minimum SDK level specified in the manifest. /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000: at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x00095] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:329 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000: at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass95_0.<InstallPackage>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00016] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:753 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000: at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in <b4d1a66727f44ba888b54966284fabb4>:0 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000: at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2343 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000: --- End of inner exception stack trace --- /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000: at Xamarin.AndroidTools.AndroidDeploySession.InstallPackage () [0x0036a] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:418 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000: at Xamarin.AndroidTools.AndroidDeploySession.RunAsync (System.Threading.CancellationToken token) [0x003ae] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:216 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0000: at Xamarin.AndroidTools.AndroidDeploySession.RunLoggedAsync (System.Threading.CancellationToken token) [0x0002f] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Sessions/AndroidDeploySession.cs:118 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0040: The device does not support the minimum SDK level specified in the manifest. /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0040: at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x00095] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:329 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0040: at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass95_0.<InstallPackage>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00016] in /Users/builder/jenkins/workspace/monodroid-multibranch_d16-0-ROFMKET2X57L6OM33VV4CLSC53EGKYMXL7RAG3T2HOJWPTP3PQCA/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:753 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0040: at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in <b4d1a66727f44ba888b54966284fabb4>:0 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(615,2): error ADB0040: at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2343

Zip Extraction code not working for Android in xamarin forms

April 11, 2019, 5:11 am

I am using below code for extraction in xamarin forms

using (ZipArchive archive = ZipFile.OpenRead("Zip file path")) { foreach (ZipArchiveEntry entry in archive.Entries) { var pathToInstall = Path.GetDirectoryName(Path.Combine("Extract Directory", entry.FullName)); if (!Directory.Exists(pathToInstall)) { Directory.CreateDirectory(pathToInstall); } using (var entryStream = entry.Open()) { entry.ExtractToFile(Path.Combine("Extract Directory", entry.FullName), true); } } }

Here** entry.ExtractToFile(Path.Combine("Extract Directory", entry.FullName), true)** is throwing below exception:

{System.IO.IOException: Invalid parameter at System.IO.File.SetLastWriteTime (System.String path, System.DateTime lastWriteTime) [0x0002a] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 at System.IO.Compression.ZipFileExtensions.ExtractToFile (System.IO.Compression.ZipArchiveEntry source, System.String destinationFileName, System.Boolean overwrite) [0x00067] in <1a0f8b38772b44ca85cc92de9ff0e2e6>:0 at SharedProject.Infrastructures.Protocols.Smb.PackageManager.Extract (System.String zipPackagePath) [0x00059] in D:\VS2017\DocSyncMobile\Xamarin Forms\DocSync\DocSync\DocSync\Infrastructures\Protocols\Smb\PackageManager.cs:41

However this code is working fine in windows.

Xamarin.Forms XAML RelativeLayout can not scroll

April 10, 2019, 11:48 pm

Hi guys, i have a piece of code like this
`

<Frame CornerRadius="6" Padding="0"> <ScrollView> <StackLayout Spacing="5" BackgroundColor="White" Padding="10" > <Label Text="お客様番号はお届けしているお水に貼付されている伝票にてご確認いただけます。" TextColor="Black" FontSize="15"></Label> <Label Text="※記載がないお客様は当社カスタマーセンターまでご連絡ください。" TextColor="Black" FontSize="15"></Label> <Image Source="voucher_sp.png"/> </StackLayout> </ScrollView> </Frame> <StackLayout> <Image Source="close_x_icon.png" HeightRequest="15" WidthRequest="15" VerticalOptions="Start" HorizontalOptions="End" x:Name="CloseIcon"/> </StackLayout> </RelativeLayout>`

and i want to create a UI that looks like this image here.

Only the original thread that created a view hierarchy can touch its views Xamarin forms

But it does not works, i'm not sure where did i go wrong. please help me.

Xamarin.Forms XAML Share and Preview

April 14, 2019, 2:05 am

Hello,
We have just released our little tool to test, share and preview Xamarin.Forms XAML:
https://xamin.azurewebsites.net

You can write the XAML/CSS and preview it on the Android app, live, without recompiling. (iOS app will be available soon)

Please feel free to use it, and send feedback to us!