This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Android Resources
Per Bothner <per@bothner.com> writes:
> On 05/18/2009 09:32 PM, Clinton Ebadi wrote:
>> It built with a few warnings and then proceeded to crash and burn. I
>> tried replacing R:... with:
>>
>> (static-field (static-field R 'layout) 'main)
>>
>> And got:
>>
>> [kawa] ... no slot `layout' in kawa.android.hello.R
>> [kawa] ... warning - more than one possibly applicable method
>> 'setContentView' in kawa.android.hello.KawaHello
>
> The path kawa.android.hello.R rather than kawa.android.R suggests
> it is looking for R in the wrong package. I suggested trying a
> fully-qualified package name: kawa.android.R.
>
> I also suggest leaving out the dots - kawa.android.R:layout:main
> rather than awa.android.R:.layout:.main - the dots are kind-of
> deprecated.
I tried this, but no dice. I checked gen/kawa/android/hello/R.java and
it appears to be defined in the kawa.android.hello package:
package kawa.android.hello;
public final class R { ...
If I explicitely qualify the name as kawa.android.R then I get warnings
about there being no declaration of R anywhere (the same as if I omit
the package or use kawa.android.hello.R). I created a jar of R*.class
and explicitly added that file to the classpath with the full pathname
(or the dir ${out-classes}/kawa/android/hello/), but that failed to work
either.
I imagine that I am doing something wrong; my ant scompile rule is:
<target name="scompile" depends="dirs, resource-src, aidl">
<apply taskname="kawa" executable="java"
failonerror="true" parallel="true">
<arg value="-classpath"/> <arg path="${external-libs-folder}/kawa.jar:${android-jar}:${out-classes}"/>
<arg value="kawa.repl"/>
<arg value="-d"/> <arg path="${out-classes}"/>
<arg line="-P ${application-package}. --module-static-run --warn-undefined-variable --warn-invoke-unknown-method"/>
<arg value="-C"/>
<fileset dir=".">
<include name="**/*.scm"/>
</fileset>
</apply>
</target>
(basically the rule you posted in the patch to build.xml on your weblog
but with the variable names updated).
I tarred up the project @
http://unknownlamer.org/files/temp/kawa-hello.tar.gz. Any ideas?
Semirelated, is there a way to create an anonymous class that implements
an interface? I decided to play around a bit and manually create a
layout, and wanted to set the onclick method of a button but:
(evalb:setOnClickListener
(let ((eval-expr (lambda () (tv:setText (ed:getText)))))
(object (android.view.View.OnClickListener)
((onClick (v :: android.view.View)) :: void
(eval-expr)))))
fails with an invalid superclass error; if I remove the superclass then
it builds but crashes (accursed java and one method anonymous
classes...).
--
Lindsay (Carlton): nighttime baker! sounds a little iffy