IneptusMechanicus
IneptusMechanicus

Reputation: 508

Xamarin Android app unfortunately stopped working

I started working on an Android app in Xamarin and so far I have only done some work on the main layout ( not yet finished), but every time I run the app to see how the layout looks on the emulator, it just gives me the"Unfortunately appName(DOS-bot in this instance) has stopped working".

Here's the layout XML:

 <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#2bced1">
        <ImageView
            android:id="@+id/botModel"
            android:src="@drawable/botModel"
            android:layout_height="match_parent"
            android:layout_width="300dp"
            android:layout_marginBottom="12dp"
            android:layout_marginTop="12dp" />
        <LinearLayout
            android:orientation="vertical"
            android:layout_toRightOf="@id/botModel"
            android:layout_height="fill_parent"
            android:layout_width="fill_parent"
            android:layout_marginTop="12dp"
            android:layout_marginBottom="12dp"
            android:layout_marginRight="8dp">
            <ImageView
                android:id="@+id/Title"
                android:src="@drawable/Title"
                android:layout_width="match_parent"
                android:layout_height="80dp" />
            <ImageButton
                android:id="@+id/NewGame"
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:layout_marginTop="6dp" />
        </LinearLayout>
    </RelativeLayout>

And the back-end code:

using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Content.PM;

namespace DOS_bot
{
    [Activity(Label = "DOS_bot", MainLauncher = true, Icon = "@drawable/icon", Theme = "@android:style/Theme.NoTitleBar.Fullscreen", ScreenOrientation = ScreenOrientation.Landscape)]
    public class MainActivity : Activity
    {         

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

            SetContentView(Resource.Layout.Main);

        }
    }
}

After looking in the Xamarin forums, I tried turning off shared runtime and fast deployment for both release and debug in the properties, but that still didn't work.

Here's the debug log, i hope it can shed some light on the problem:

07-14 00:31:41.095 I/SurfaceComposerClient(  464): update getting screenshot size 452 x 803
07-14 00:31:41.095 I/SurfaceComposerClient(  464): Opening socket to screenshot pipe.
07-14 00:31:41.095 I/ActivityManager(  464): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=DOS_bot.DOS_bot/md561025751d54c13647beead4a9be33f78.MainActivity} from pid 704
07-14 00:31:41.099 I/DonatelloScreenshot(  464): Capturing screenshot. (w=452 h=803, rot=0, crop l=0 r=1080 t=0 b=1920)
07-14 00:31:41.099 I/DonatelloService(  491): Checking type.
07-14 00:31:41.099 I/DonatelloService(  491): Read hal pipe type Gpu.
07-14 00:31:41.099 I/DonatelloService(  491): Donatello HAL screen shot
07-14 00:31:41.099 I/DonatelloService(  491): Forwarding request
07-14 00:31:41.099 I/DonatelloService(  491): Forwarding data, planning to write 28.
07-14 00:31:41.099 I/DonatelloService(  491): Reallocating bigger buffer
07-14 00:31:41.099 I/DonatelloService(  491): Request sent
07-14 00:31:41.203 I/DonatelloService(  491): Forwarding data, planning to write 1451824.
07-14 00:31:41.203 I/DonatelloService(  491): Reallocating bigger buffer
07-14 00:31:41.359 I/DonatelloService(  491): Done.
07-14 00:31:41.399 I/SurfaceComposerClient(  464): update screenshot succeeded!
07-14 00:31:41.407 D/dalvikvm(  464): GC_FOR_ALLOC freed 744K, 9% free 8611K/9424K, paused 11ms, total 11ms
07-14 00:31:41.407 I/dalvikvm-heap(  464): Grow heap (frag case) to 9.165MB for 723212-byte allocation
07-14 00:31:41.415 D/dalvikvm(  464): GC_FOR_ALLOC freed 14K, 9% free 9302K/10132K, paused 8ms, total 8ms
07-14 00:31:41.419 I/DonatelloService(  491): Channel has closed.
07-14 00:31:41.419 I/DonatelloService(  491): Closing channel.
07-14 00:31:41.435 D/dalvikvm( 1167): Late-enabling CheckJNI
07-14 00:31:41.435 I/ActivityManager(  464): Start proc DOS_bot.DOS_bot for activity DOS_bot.DOS_bot/md561025751d54c13647beead4a9be33f78.MainActivity: pid=1167 uid=10054 gids={50054, 3003}
07-14 00:31:41.455 D/PermissionCache(  139): checking android.permission.READ_FRAME_BUFFER for uid=1000 => granted (164 us)
07-14 00:31:41.455 E/gralloc_donatello(  139): gralloc_alloc: Mismatched usage flags: 1080 x 1920, usage b33
07-14 00:31:41.455 W/GraphicBufferAllocator(  139): alloc(1080, 1920, 1, 00000b33, ...) failed -22 (Invalid argument)
07-14 00:31:41.455 E/        (  139): GraphicBufferAlloc::createGraphicBuffer(w=1080, h=1920) failed (Invalid argument), handle=0x0
07-14 00:31:41.455 E/BufferQueue(  139): [ScreenshotSurface] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
07-14 00:31:41.479 I/ActivityManager(  464): Config changes=480 {1.0 ?mcc?mnc en_US ldltr sw391dp w654dp h366dp 441dpi nrml land finger qwerty/v/v -nav/h s.6}
07-14 00:31:41.511 D/PhoneStatusBar(  580): mSettingsPanelGravity = 55
07-14 00:31:41.527 I/InputReader(  464): Reconfiguring input devices.  changes=0x00000004
07-14 00:31:41.527 I/InputReader(  464): Device reconfigured: id=3, name='Donatello Virtual Touch Device', size 1080x1920, orientation 1, mode 1, display id 0
07-14 00:31:41.527 I/InputReader(  464): Device reconfigured: id=6, name='Microsoft Vmbus HID-compliant Mouse', size 1080x1920, orientation 1, mode 1, display id 0
07-14 00:31:41.527 I/InputReader(  464): Reconfiguring input devices.  changes=0x00000004
07-14 00:31:41.551 D/AndroidRuntime( 1167): Shutting down VM
07-14 00:31:41.551 W/dalvikvm( 1167): threadid=1: thread exiting with uncaught exception (group=0xa8d2eb20)
07-14 00:31:41.551 E/AndroidRuntime( 1167): FATAL EXCEPTION: main
07-14 00:31:41.551 E/AndroidRuntime( 1167): Process: DOS_bot.DOS_bot, PID: 1167
07-14 00:31:41.551 E/AndroidRuntime( 1167): java.lang.UnsatisfiedLinkError: Couldn't load monodroid from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/DOS_bot.DOS_bot-1.apk"],nativeLibraryDirectories=[/data/app-lib/DOS_bot.DOS_bot-1, /system/lib]]]: findLibrary returned null
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at java.lang.Runtime.loadLibrary(Runtime.java:358)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at java.lang.System.loadLibrary(System.java:526)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at mono.MonoPackageManager.LoadApplication(MonoPackageManager.java:34)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:22)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at android.app.ActivityThread.installProvider(ActivityThread.java:4774)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4369)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4309)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at android.app.ActivityThread.access$1500(ActivityThread.java:135)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at android.os.Handler.dispatchMessage(Handler.java:102)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at android.os.Looper.loop(Looper.java:136)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at android.app.ActivityThread.main(ActivityThread.java:5001)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at java.lang.reflect.Method.invokeNative(Native Method)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at java.lang.reflect.Method.invoke(Method.java:515)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
07-14 00:31:41.551 E/AndroidRuntime( 1167):     at dalvik.system.NativeStart.main(Native Method)
07-14 00:31:41.555 W/ActivityManager(  464):   Force finishing activity DOS_bot.DOS_bot/md561025751d54c13647beead4a9be33f78.MainActivity
07-14 00:31:41.603 D/dalvikvm(  580): GC_FOR_ALLOC freed 5328K, 25% free 9594K/12692K, paused 9ms, total 9ms
07-14 00:31:41.607 I/dalvikvm-heap(  580): Grow heap (frag case) to 12.356MB for 3072012-byte allocation
07-14 00:31:41.615 D/dalvikvm(  580): GC_CONCURRENT freed 76K, 21% free 12517K/15696K, paused 1ms+1ms, total 6ms
07-14 00:31:41.659 I/ActivityManager(  464): Config changes=480 {1.0 ?mcc?mnc en_US ldltr sw391dp w391dp h623dp 441dpi nrml port finger qwerty/v/v -nav/h s.7}
07-14 00:31:41.679 I/InputReader(  464): Reconfiguring input devices.  changes=0x00000004
07-14 00:31:41.679 I/InputReader(  464): Device reconfigured: id=3, name='Donatello Virtual Touch Device', size 1080x1920, orientation 0, mode 1, display id 0
07-14 00:31:41.679 I/InputReader(  464): Device reconfigured: id=6, name='Microsoft Vmbus HID-compliant Mouse', size 1080x1920, orientation 0, mode 1, display id 0
07-14 00:31:41.695 E/BluetoothAdapter(  649): Bluetooth binder is null
07-14 00:31:41.743 I/WindowManager(  464): Screen frozen for +293ms due to Window{a9358f48 u0 Application Error: DOS_bot.DOS_bot}
07-14 00:31:41.747 D/dalvikvm(  580): GC_FOR_ALLOC freed 3007K, 25% free 9532K/12692K, paused 3ms, total 4ms
07-14 00:31:41.747 I/dalvikvm-heap(  580): Grow heap (frag case) to 12.295MB for 3072012-byte allocation
07-14 00:31:41.755 D/dalvikvm(  580): GC_CONCURRENT freed 49K, 21% free 12482K/15696K, paused 1ms+1ms, total 7ms
07-14 00:31:41.827 D/PhoneStatusBar(  580): mSettingsPanelGravity = 55
07-14 00:31:42.159 W/ActivityManager(  464): Activity pause timeout for ActivityRecord{a964ea20 u0 DOS_bot.DOS_bot/md561025751d54c13647beead4a9be33f78.MainActivity t3 f}
07-14 00:31:42.187 W/EGL_emulation(  704): eglSurfaceAttrib not implemented
07-14 00:31:43.776 D/dalvikvm(  464): GC_EXPLICIT freed 943K, 14% free 9356K/10840K, paused 0ms+1ms, total 21ms
07-14 00:31:43.840 I/Process ( 1167): Sending signal. PID: 1167 SIG: 9
07-14 00:31:43.840 W/InputMethodManagerService(  464): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@a933e328 attribute=null, token = android.os.BinderProxy@a932cd48
07-14 00:31:43.888 I/ActivityManager(  464): Process DOS_bot.DOS_bot (pid 1167) has died.

Upvotes: 2

Views: 1945

Answers (1)

Bill
Bill

Reputation: 4646

From Xamarin developer website:

Release apps fail to launch on device

If so, there are two possible causes for this:

  1. The .apk doesn't provide an ABI that the target device supports. For example, the .apk only contains armeabi-v7a binaries, and the target device only supports armeabi.
  2. An Android bug. If this is the case, uninstall the app, cross your fingers, and reinstall the app.

To fix (1), edit the Project Options/Properties and add support for the required ABI to the list of Supported ABIs. To determine which ABI you need to add, run the following adb command against your target device:

adb shell getprop ro.product.cpu.abi
adb shell getprop ro.product.cpu.abi2

The output will contain the primary (and optional secondary) ABIs.

$ adb shell getprop | grep ro.product.cpu
[ro.product.cpu.abi2]: [armeabi]
[ro.product.cpu.abi]: [armeabi-v7a]

Upvotes: 4

Related Questions