1

我已经使用 Visual Studio 2012 和适用于 Android 的 mono 构建了一个简单的“Hello World”应用程序。问题是该应用程序在三星 Galaxy S3 和 LG Optymus L2 中运行良好,但在 Galaxy S3 mini 中打开时无故崩溃。所有手机都使用相同的 Android 版本 4.1.2。我不知道问题出在哪里。这是代码,是Visual Studio生成的“Hello World”:

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

namespace HelloWorld
{
[Activity(Label = "HelloWorld", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 : Activity
{
    int count = 1;

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

        SetContentView(Resource.Layout.Main);

        Button button = FindViewById<Button>(Resource.Id.MyButton);

        button.Click += delegate { button.Text = string.Format("{0} clicks!",       count++); };
    }
}
}

编译时的Android Log:

Loaded assembly: HelloWorld.dll
Loaded assembly: Mono.Android.dll [External]
Loaded assembly: System.Core.dll [External]
10-29 12:35:30.913 E/Trace   ( 5848): error opening trace file: No such file or       directory (2)
10-29 12:35:30.941 V/ActivityThread( 5848): Class path: /data/app /HelloWorld.HelloWorld-1.apk, JNI path: /data/data/HelloWorld.HelloWorld/lib
10-29 12:35:30.945 I/ActivityThread( 5848): Pub        HelloWorld.HelloWorld.mono.MonoRuntimeProvider.__mono_init__: mono.MonoRuntimeProvider
10-29 12:35:30.946 D/dalvikvm( 5848): Trying to load lib /data/data/HelloWorld.HelloWorld/lib/libmonodroid.so 0x422857b0
10-29 12:35:30.951 D/dalvikvm( 5848): Added shared lib /data/data/HelloWorld.HelloWorld    /lib/libmonodroid.so 0x422857b0
10-29 12:35:30.952 W/MonoDroid-Debugger( 5848): Trying to initialize the debugger with options: --debugger-
agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8889,server=y,embedding=1
10-29 12:35:31.062 W/MonoDroid-Debugger( 5848): Accepted stdout connection: 42
10-29 12:35:32.136 W/monodroid-gc( 5848): GREF GC Threshold: 46800
Loaded assembly: MonoDroidConstructors [External]
10-29 12:35:33.296 I/SurfaceTextureClient( 5848): [void android::SurfaceTextureClient::init()] debug.stc.fps: 3000 ms
10-29 12:35:33.300 D/libEGL  ( 5848): loaded /vendor/lib/egl/libEGL_mtk.so
10-29 12:35:33.304 D/libEGL  ( 5848): loaded /vendor/lib/egl/libGLESv1_CM_mtk.so
10-29 12:35:33.310 D/libEGL  ( 5848): loaded /vendor/lib/egl/libGLESv2_mtk.so
10-29 12:35:33.342 E/MMUMapper( 5848): fail to register MVA, unsupported format(0x5)
10-29 12:35:33.343 D/OpenGLRenderer( 5848): Enabling debug mode 0
10-29 12:35:33.396 E/MMUMapper( 5848): fail to register MVA, unsupported format(0x5)
10-29 12:35:37.452 D/VelocityTracker( 5848): Couldn't open '/dev/touch' (No such file or directory)
10-29 12:35:37.461 D/VelocityTracker( 5848): tpd read x fail: Bad file number
10-29 12:35:37.462 D/VelocityTracker( 5848): tpd read y fail: Bad file number
10-29 12:35:37.474 I/SurfaceTextureClient( 5848): [0x53cf7038] frames:2, duration:4.086000, fps:0.489472
10-29 12:35:37.482 E/MMUMapper( 5848): fail to register MVA, unsupported format(0x5)
10-29 12:35:37.490 V/Provider/Setting( 5848): invalidate [system]: current 58 != cached 0
10-29 12:35:37.492 V/Provider/Setting( 5848): from db cache, name = sound_effects_enabled value = 1
10-29 12:35:37.743 V/Provider/Setting( 5848): from settings cache , name = sound_effects_enabled value = 1
10-29 12:35:38.147 V/Provider/Setting( 5848): from settings cache , name = sound_effects_enabled value = 1

有人知道可能是什么吗?

谢谢

4

1 回答 1

1

我回答我自己的问题:

还有一个问题,就是我没有调试那个型号的手机,因为没有它,但是拿到一个之后,我发现问题要容易得多。只是手机无法在资源中找到正确的分辨率图像,因为它不存在。我创建了图像,一切都很完美。

我认为如果我在模拟器中回复了模型电话,我可以更快地解决问题。

于 2013-11-05T17:21:31.653 回答