question

BenjaminBlanco-1413 avatar image
0 Votes"
BenjaminBlanco-1413 asked RobCaplan edited

App crashed when I add controls

My native Xamarin WebView app works fine until I add a button or progressbar. If I uncomment one of the controls in the code below the app crashed upon startup. What am I doing wrong?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!--
    <Button
        android:layout_weight="34" 
        android:layout_width="0dip"
        android:layout_height="wrap_content" 
        android:orientation="vertical"
        android:text="Home"
        android:id="@+id/btnHome" />
    -->

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/relativeLayout1">
        <!--<ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:visibility="invisible"
            android:id="@+id/progressBar1" />-->

        <android.webkit.WebView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/webView1" />
    </RelativeLayout>

</LinearLayout>
dotnet-xamarin
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

do you see an exception / error in the output window?

0 Votes 0 ·

Nope:
1>(CoreCompile target) ->
1> C:\Users\benbl\Source\Workspaces\ST Mobile\StarTracker Mobile Warehouse\StarTracker Mobile Warehouse\MainActivity.cs(37,21,37,32): warning CS0169: The field 'MainActivity.progressBar' is never used
1>
1> 1 Warning(s)
1> 0 Error(s)
1>
1>Time Elapsed 00:00:20.20
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

0 Votes 0 ·

I did a test, but I couldn't reproduce this problem based on above code. You can recheck if you have added other code in other places(e.g. your activity) which refers to the ID of the control you commented out.

0 Votes 0 ·

Literally the only difference between it running and it crashing on startup is the uncommenting of the controls.

0 Votes 0 ·

Could you please post a basic demo to github or onedriver so that we can test on our side?In addition , could you please post the error log about this problem?

0 Votes 0 ·

Hi @BenjaminBlanco-1413 , I have not heard from you for a couple of days. Please let me know if there is anything that I can help here.

0 Votes 0 ·
Show more comments

1 Answer

BenjaminBlanco-1413 avatar image
0 Votes"
BenjaminBlanco-1413 answered

All I did was create a new project, copied over the layout, code, and Manifest settings, and it works fine. So, I guess something on my original project dependencies or something was corrupted.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.