没有调试器,Xamarin Android应用程序无法运行

时间:2017-04-10 16:53:42

标签: c# android debugging xamarin release

我想为我的应用程序创建一个安装程序,但每次我尝试使用“Relase”配置部署我的应用程序时,android表示不幸的是我的应用程序停止了工作。我已经尝试了很多配置,但没有一个可以工作。
当我注释掉我的构造函数和onCreate()方法(我把它留空)时,我的viusal能够很好地部署它。
注意如果我取消选中“启用开发人员检测”,则应用程序崩溃,并且还使用其他权限(内存中的读/写和振动)

在这一点上,我不确定我的代码,配置或其他东西有什么问题。有解决方案吗
以下是一些构建日志(发布):https://pastebin.com/1b3cNEdV
和另一个(调试):https://pastebin.com/01PaLE6A
日志形式Xamarin.Diagnostic - 发布:

[I:]:                     Found Android SDK. API levels: 23
[D:RunShellCommand]:      CB5A239RH1 getprop
[D:RunShellCommand]:      CB5A239RH1 am broadcast -a "mono.android.intent.action.PACKAGE_VERSIONS" -e "packages" "Mono.Android.DebugRuntime,Mono.Android.Platform.ApiLevel_23,Company.SomeApk" -n "Mono.Android.DebugRuntime/com.xamarin.mono.android.PackageVersions"
[D:RunShellCommand]:      CB5A239RH1 pm uninstall -k "Company.SomeApk"
[D:RunShellCommand]:      CB5A239RH1 pm uninstall -k "Company.SomeApk"
[D:RunShellCommand]:      CB5A239RH1 pm install "/data/local/tmp/Company.SomeApk-Signed.apk"
[D:RunShellCommand]:      CB5A239RH1 rm "/data/local/tmp/Company.SomeApk-Signed.apk"
[D:RunShellCommand]:      CB5A239RH1 setprop "debug.mono.extra" ""
[D:RunShellCommand]:      CB5A239RH1 getprop
[D:RunShellCommand]:      CB5A239RH1 am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "Company.SomeApk/md50a67931533d839ddffd2f552f381ffaf.MainActivity"
[D:RunShellCommand]:      CB5A239RH1 "echo" "-n" "${EMULATED_STORAGE_SOURCE}"
[D:RunShellCommand]:      CB5A239RH1 "echo" "-n" "${EMULATED_STORAGE_TARGET}"
[D:RunShellCommand]:      CB5A239RH1 am broadcast -a "mono.android.intent.action.EXTERNAL_STORAGE_DIRECTORY" -n "Mono.Android.DebugRuntime/com.xamarin.mono.android.ExternalStorageDirectory"
[D:RunShellCommand]:      CB5A239RH1 rm -f "/mnt/shell/emulated/0/Android/data/Company.SomeApk/files/.__override__/debug.mono.extra"

和Debug:

[I:]:                     Found Android SDK. API levels: 23
[D:RunShellCommand]:      CB5A239RH1 getprop
[D:RunShellCommand]:      CB5A239RH1 am broadcast -a "mono.android.intent.action.PACKAGE_VERSIONS" -e "packages" "Mono.Android.DebugRuntime,Mono.Android.Platform.ApiLevel_23,Company.SomeApk" -n "Mono.Android.DebugRuntime/com.xamarin.mono.android.PackageVersions"
[D:RunShellCommand]:      CB5A239RH1 pm uninstall -k "Company.SomeApk"
[D:RunShellCommand]:      CB5A239RH1 pm uninstall -k "Company.SomeApk"
[D:RunShellCommand]:      CB5A239RH1 pm install "/data/local/tmp/Company.SomeApk-Signed.apk"
[D:RunShellCommand]:      CB5A239RH1 rm "/data/local/tmp/Company.SomeApk-Signed.apk"
[D:RunShellCommand]:      CB5A239RH1 "pm" "path" "Company.SomeApk"
[D:RunShellCommand]:      CB5A239RH1 "echo" "-n" "${EMULATED_STORAGE_SOURCE}"
[D:RunShellCommand]:      CB5A239RH1 "echo" "-n" "${EMULATED_STORAGE_TARGET}"
[D:RunShellCommand]:      CB5A239RH1 am broadcast -a "mono.android.intent.action.EXTERNAL_STORAGE_DIRECTORY" -n "Mono.Android.DebugRuntime/com.xamarin.mono.android.ExternalStorageDirectory"
[D:RunShellCommand]:      CB5A239RH1 ls /mnt/shell/emulated/0/Android/data/Company.SomeApk/files/.__override__
[D:NotifyPhase]:          Enumerating remote files
[D:NotifyPhase]:          Determining required operations
[D:NotifyPhase]:          Creating directories
[D:NotifySync]:           CreateDirectory  /mnt/shell/emulated/0/Android/data/Company.SomeApk/files/.__override__ 0
[D:NotifyPhase]:          Uploading files
[D:NotifySync]:           CopyFile C:\Users\Salin\Source\Repos\CompanyAndroid\CompanyAndroid\obj\Debug\android\assets\SomeApk.dll /mnt/shell/emulated/0/Android/data/Company.SomeApk/files/.__override__/SomeApk.dll 55296
[D:NotifySync]:           CopyFile C:\Users\Salin\Source\Repos\CompanyAndroid\CompanyAndroid\obj\Debug\android\assets\SomeApk.dll.mdb /mnt/shell/emulated/0/Android/data/Company.SomeApk/files/.__override__/SomeApk.dll.mdb 11653
[D:NotifyPhase]:          Upload completed
[D:NotifyPhase]:          Enumerating remote files
[D:NotifyPhase]:          Determining required operations
[D:NotifyPhase]:          Creating directories
[D:NotifySync]:           SkipCreateDirectory  /mnt/shell/emulated/0/Android/data/Company.SomeApk/files/.__override__ 0
[D:NotifySync]:           CreateDirectory  /mnt/shell/emulated/0/Android/data/Company.SomeApk/files/.__override__/lib 0
[D:NotifyPhase]:          Uploading files
[D:NotifyPhase]:          Upload completed
[D:NotifyPhase]:          Enumerating remote files
[D:NotifyPhase]:          Determining required operations
[D:NotifyPhase]:          Creating directories
[D:NotifySync]:           SkipCreateDirectory  /mnt/shell/emulated/0/Android/data/Company.SomeApk/files/.__override__ 0
[D:NotifySync]:           CreateDirectory  /mnt/shell/emulated/0/Android/data/Company.SomeApk/files/.__override__/dexes 0
[D:NotifyPhase]:          Uploading files
[D:NotifyPhase]:          Upload completed
[D:NotifyPhase]:          Enumerating remote files
[D:NotifyPhase]:          Determining required operations
[D:NotifyPhase]:          Creating directories
[D:NotifySync]:           SkipCreateDirectory  /mnt/shell/emulated/0/Android/data/Company.SomeApk/files/.__override__ 0
[D:NotifyPhase]:          Uploading files
[D:NotifyPhase]:          Upload completed
[D:NotifyPhase]:          Enumerating remote files
[D:NotifyPhase]:          Determining required operations
[D:NotifyPhase]:          Creating directories
[D:NotifySync]:           SkipCreateDirectory  /mnt/shell/emulated/0/Android/data/Company.SomeApk/files/.__override__ 0
[D:NotifySync]:           CreateDirectory  /mnt/shell/emulated/0/Android/data/Company.SomeApk/files/.__override__/resources 0
[D:NotifyPhase]:          Uploading files
[D:NotifyPhase]:          Upload completed
[D:RunShellCommand]:      CB5A239RH1 date +%s
[D:RunShellCommand]:      CB5A239RH1 setprop "debug.mono.extra" "debug=127.0.0.1:8953:8954,timeout=1491841429,loglevel=0,server=y"
[D:RunShellCommand]:      CB5A239RH1 getprop
[D:RunShellCommand]:      CB5A239RH1 "echo" "-n" "${EMULATED_STORAGE_SOURCE}"
[D:RunShellCommand]:      CB5A239RH1 "echo" "-n" "${EMULATED_STORAGE_TARGET}"
[D:RunShellCommand]:      CB5A239RH1 am broadcast -a "mono.android.intent.action.EXTERNAL_STORAGE_DIRECTORY" -n "Mono.Android.DebugRuntime/com.xamarin.mono.android.ExternalStorageDirectory"
[D:RunShellCommand]:      CB5A239RH1 am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "Company.SomeApk/md50a67931533d839ddffd2f552f381ffaf.MainActivity"
[D:RunShellCommand]:      CB5A239RH1 ps
[D:GetLogCat]:            logcat -v time
[D:RunShellCommand]:      CB5A239RH1 logcat -v time
[D:RunShellCommand]:      CB5A239RH1 am force-stop Company.SomeApk
[D:RunShellCommand]:      CB5A239RH1 setprop "debug.mono.connect" ""

包装发布 Release android properties 链接器发布 Relase android linker 打包调试 Debug android properties 链接器调试 Debug android linker

更新

public MainActivity()
        {
            XmlHandler.XmlFileExist();
            XmlHandler.XmlLoadList(ref dataList);

            nodeButtonCount = XmlHandler.XmlCountNodes("Button");
            nodeSliderCount = XmlHandler.XmlCountNodes("SliderBar");
            buttonCommands = new string[nodeButtonCount]; buttonCollorsEnabled = new string[nodeButtonCount]; buttonCollorsDisabled = new string[nodeButtonCount];
            fontCollors = new string[nodeButtonCount]; buttonText = new string[nodeButtonCount]; buttonVisible = new string[nodeButtonCount];
            sliderCommands = new string[nodeSliderCount]; sliderMaxValue = new string[nodeSliderCount];
            sliderMinValue = new string[nodeSliderCount]; sliderVisible = new string[nodeSliderCount];
            buttonEnabledAlpha = new int[nodeButtonCount]; buttonEnabledRed = new int[nodeButtonCount];
            buttonEnabledGreen = new int[nodeButtonCount]; buttonEnabledBlue = new int[nodeButtonCount];
            buttonDisabledAlpha = new int[nodeButtonCount]; buttonDisabledRed = new int[nodeButtonCount];
            buttonDisabledGreen = new int[nodeButtonCount]; buttonDisabledBlue = new int[nodeButtonCount];
            sliderLeft = new string[nodeSliderCount]; sliderRight = new string[nodeSliderCount];

            //Loading commands
            XmlHandler.XmlLoadButtons(ref buttonCommands, ref fontCollors, ref buttonCollorsEnabled, ref buttonCollorsDisabled,
                ref buttonText, ref buttonVisible, nodeButtonCount);
            XmlHandler.XmlLoadSliders(ref sliderCommands, ref sliderMinValue, ref sliderMaxValue, ref sliderVisible,
                ref sliderLeft, ref sliderRight, nodeSliderCount);
        }

我在这里所做的就是加载默认配置。这是“XmlLoadSliders”的代码:

 public static bool XmlLoadSliders(ref string[] SliderCommand,ref string[] SliderMin, ref string[] SliderMax, ref string[] SliderVisible,
        ref string[] ToLeftOf, ref string[] ToRightOf,int lenght)
    {
        if (!File.Exists(path))
            return false;

        XDocument xmlConfig = XDocument.Load(path);

        var slider = from node in xmlConfig.Descendants("SliderBar")
                     select new
                     {
                         command = node.Element("Command"),
                         max = node.Element("Max"),
                         min = node.Element("Min"),
                         visible = node.Element("Visible"),
                         toLeftOf = node.Element("ToLeftOf"),
                         toRightOf = node.Element("ToRightOf")
                     };

        int i = 0;
        foreach (var item in slider)
        {
            if (i > lenght)
                break;
            SliderCommand[i] = ">" + item.command.Value + "<";
            SliderMax[i] = item.max.Value;
            SliderMin[i] = item.min.Value;
            SliderVisible[i] = item.visible.Value;
            ToLeftOf[i] = item.toLeftOf.Value;
            ToRightOf[i] = item.toRightOf.Value;
            i++;
        }

        return true;
    }

0 个答案:

没有答案
相关问题