我已经使用Visual Studio 2012和用于Android的mono构建了一个简单的“ Hello World”应用程序。问题在于该应用程序可以在Samsung 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日志:

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


有人知道会是什么吗?

谢谢

最佳答案

我回答我自己的问题:

还有另一个问题,就是我无法调试该型号的手机,因为没有它,但是拿到一个之后,我发现问题要容易得多。只是因为手机不存在,所以无法在资源中找到适合分辨率的正确图像。我创建了图像,并且一切正常。

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

10-07 19:47