今のところ、「R」クラスをインポートすることはできませんが、コンパイルしました。次の手順を実行します。
最初に、Eclipse アップデート マネージャーに Xtend SDK をインストールします。 「Xtend2 SDK」を選択します。待ってから、Eclipse を再起動します。
Eclipse Android プロジェクト フォルダーで、ファイル「.project」を編集し (たとえば、OSX のターミナルで「nano .project」と入力して)、次のように変更します (名前を除いて、実際にはコンテンツ全体をコピーできます)。名前をプロジェクト名に戻します):
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>TestAndroidXtend</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
次に、クラスパス要素内のファイル「.classpath」に次を挿入します。
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
com.android.ide.eclipse.adt.ANDROID_FRAMEWORK のエントリの前に配置しましたが、おそらくそれも行う必要があります。
Eclipse に戻り、F5 でプロジェクトを更新し、プロジェクトの最上位に "META-INF" フォルダーを作成し、空のファイル "MANIFEST.MF" を作成します。次の内容を貼り付けます。
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Xtend Tutorial
Bundle-SymbolicName: xtend.tutorial
Bundle-Version: 2.1.0.qualifier
Bundle-Vendor: Eclipse Modeling
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.xtext.xtend2.lib;bundle-version="2.0.0",
org.junit4,
org.aopalliance;bundle-version="1.0.0"
プロジェクトで「プロジェクト」->「クリーン」を実行すると、Xtend クラスを作成して使用できるようになります。
前に述べたように、R クラスをインポートすることはできません。おそらく、Xtend は通常の「src」フォルダーでクラス ファイルを検索するだけです。