【问题标题】:Couldn't load Main.axml in Xamarin Studio无法在 Xamarin Studio 中加载 Main.axml
【发布时间】:2015-11-06 22:25:37
【问题描述】:

这是第一次使用 Xamarin。

我无法在内容选项卡中打开 Main.axml,以修改应用程序视图。

我只能在源标签中显示它。

错误信息是“无法加载布局:由于内部错误导致操作失败:com.android.ide.common.rendering.api.SessionParams.(Lcom/android...

有人知道怎么解决吗?

感谢大家的帮助,

【问题讨论】:

  • 可以显示Main.axml的内容吗?
  • 是默认的Iain,如下图; schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> 感谢您的帮助,跨度>

标签: android android-layout xamarin mono


【解决方案1】:

觉得格式有点不对,试试这个:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <Button
        android:id="@+id/myButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />
</LinearLayout>

改变的步骤:

  1. 去掉xmlns:android="schemas.android.com/apk/res/android"末尾的分号
  2. xmlns:android="schemas.android.com/apk/res/android" 更改为 xmlns:android="http://schemas.android.com/apk/res/android" - 认为删除“http://”可能只是 StackOverflow cmets 的格式
  3. 最后将layout_widthlayout_height 中的"fill_parent" 更改为"match_parent" 关于区别here 的小信息

【讨论】:

  • 对不起,Iain,但它不起作用即使我将 Main.axml 源代码留空,内容选项卡仍然给我这个错误消息。再次感谢您的帮助
  • 是的,还是一样。这是当前的源文件; schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
  • 如果你去掉 xmlns:android="schemas.android.com/apk/res/android" 末尾的分号,它会起作用吗?
【解决方案2】:

您的 Android SDK 安装似乎不完整/损坏/不匹配。

如果您运行 Android SDK 管理器(或 Android Studio),是否会报告任何错误?使用管理器更新到 SDK 24.3+

如果您仍有问题,请将整个日志发布为 gist.github.com(或类似名称),以便我们查看 XS 的整个跟踪。

您还在使用 Windows 还是 OS-X?

Xamarin Studio
Version 5.9.4 (build 5)
Installation UUID: c9eca622-356f-4681-a1d2-069016cc404f
Runtime:
    Mono 4.0.2 ((detached/198235d)
    GTK+ 2.24.23 (Raleigh theme)
    Package version: 400020004
Xamarin.Android
Version: 5.1.4.8
Android SDK: /Users/administrator/Library/Developer/Xamarin/android-sdk-mac_x86
    Supported Android versions:
        2.3   (API level 10)
        4.0.3 (API level 15)
        4.4   (API level 19)
Java SDK: /usr
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

【讨论】:

  • 仅供参考:Iain 列出的 AXML 是正确的,并且在 XS 中正确加载/显示。
  • 谢谢罗伯特,是的,安装 Xamarin 时似乎出现了一些问题。在安装 Xamarin 之前,我必须卸载它,并安装所有 Android SKD 和其他工具,现在一切都已修复。非常感谢您的帮助,
  • 很高兴听到,愉快的编码
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-09-25
  • 1970-01-01
  • 2019-08-24
  • 2018-07-13
  • 1970-01-01
  • 2016-10-23
  • 2018-08-27
相关资源
最近更新 更多