无法在 Xamarin Studio 中加载 Main.axml

Couldn't load Main.axml in Xamarin Studio

第一次使用Xamarin

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

我只能在源选项卡中显示它。

错误消息是“无法加载布局:操作因内部错误而失败:com.android.ide.common.rendering.api.SessionParams。(Lcom/android...

有谁知道如何修复它。

感谢大家的帮助,

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

<?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. 末尾的分号
  3. xmlns:android="schemas.android.com/apk/res/android"改为 xmlns:android="http://schemas.android.com/apk/res/android" - 认为删除 'http://' 可能只是 Whosebug 评论的格式
  4. 最终在 layout_widthlayout_height 中将 "fill_parent" 更改为 "match_parent" 关于差异的信息很少 here

您的 Android SDK 安装似乎是 incomplete/corrupt/mis-matched。

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

如果您仍然有问题,post 将整个日志作为 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)