dotnet/android-tools

android.system.ErrnoException: open failed: ENOENT (No such file or directory)

Opened this issue · 0 comments

Describe the bug

Xamarin.Forms Android App,
MinAPI Level is 32, Target API is 33.
Physical test device - Samsung SM-P610, - Android 13

Dev env - VS2022, Xamarin.Forms Android. all updated, latest SDKs installed. Latest plugins updated.

The app starts, displays the splashscreen then crashes.

The output gives me this:

am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "com.MyCmpany.MyCmpany/crc6426fa50a95f21a1e8.MainActivity"
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.MyCmpany.MyCmpany/crc6426fa50a95f21a1e8.MainActivity

the device log has these two entries:

Time Device Name Type PID Tag Message
01-27 20:38:17.401 Samsung SM-P610 Warning 5669 System.err Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:274)
at libcore.io.IoBridge.open(IoBridge.java:560)
... 11 more
01-27 20:38:17.396 Samsung SM-P610 Warning 5669 System.err java.io.FileNotFoundException: /proc/16061/io_record_control: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:574)
at java.io.FileOutputStream.(FileOutputStream.java:236)
at java.io.FileOutputStream.(FileOutputStream.java:186)
at java.io.FileWriter.(FileWriter.java:96)
at com.android.server.am.Pageboost$IoRecord.write(Pageboost.java:1699)
at com.android.server.am.Pageboost$IoRecord.getResultFromKernel(Pageboost.java:1923)
at com.android.server.am.Pageboost$PageboostHandler.handleMessage(Pageboost.java:2451)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.os.HandlerThread.run(HandlerThread.java:67)
at com.android.server.ServiceThread.run(ServiceThread.java:44)

I believe this is a device/app permission issue however, putting a break in the OnCreate() code of the MainActivity is not even reached. Nor are there any files missing from resources else it won't build.

[Activity(Label = Constants.MyCmpany_DROID, Icon = "@mipmap/icon", RoundIcon = "@mipmap/icon_round", Exported = true, ScreenOrientation = ScreenOrientation.Portrait, LaunchMode = LaunchMode.SingleTop, MainLauncher = true)]

AND

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{

    private Auth0Client auth0Client;
    private AuthorizeState authorizeState;

    MobileServiceUser serviceUser;

    protected override void OnCreate(Bundle bundle)
    {
        //System.Diagnostics.Debug.WriteLine("HERE!"); **//breakpoint or this line is never reached when commented in...**

        AndroidX.Core.SplashScreen.SplashScreen.InstallSplashScreen(this);

        TabLayoutResource = Resource.Layout.Tabbar;
        ToolbarResource = Resource.Layout.Toolbar;

        base.SetTheme(Resource.Style.MyTheme);
        base.OnCreate(bundle);
        Xamarin.Essentials.Platform.Init(this, bundle);
.....
        LoadApplication(new MyCompany.App());

So this might not be splash screen related BUT it never gets past the splashscreen.

One thought on this ... is there any obvious reason why the OS would not display permission popups when app is freshly installed?
Permissions include -

ACCESS_NETWORK_STATE, READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE, INTERNET, 
ACCESS_WIFI_STATE, ACCEPT_HANDOVER, BILLING ... and
uses-permission android:name="com.google.android.gms.permission.AD_ID
uses-permission android:name="android.permission.WRITE_APN_SETTINGS

ANY advice on this would be welcome.