Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
169 views
in Technique[技术] by (71.8m points)

lambdaj fails java.lang.ExceptionInInitializerError with any call on Android

I'm trying to use lambdaj on Android but with every simple call I make I get an exception (java.lang.ExceptionInInitializerError).

The class that fills the collection is:

@DatabaseTable(tableName = "sections")
public class Section {

    @DatabaseField(id = true, unique = true)
    private int id;

    @DatabaseField(canBeNull = false)
    private String name;

    public Section() {

    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

The annotations are used by ORMLite. I left them in case they could be relevant somehow. I doubt it though.

And now if I try to make a simple call like, it crashes:

List<Section> sections = fillSections(); //this is correctly filled
select(sections, having(on(Section.class).getId(), Matchers.greaterThan(1)))

Logcat:

 FATAL EXCEPTION: main
 java.lang.ExceptionInInitializerError
    at ch.lambdaj.proxy.ProxyUtil.createEnhancer(ProxyUtil.java:89)
    at ch.lambdaj.proxy.ProxyUtil.createProxy(ProxyUtil.java:49)
    at ch.lambdaj.function.argument.ArgumentsFactory.createPlaceholder(ArgumentsFactory.java:68)
    at ch.lambdaj.function.argument.ArgumentsFactory.registerNewArgument(ArgumentsFactory.java:58)
    at ch.lambdaj.function.argument.ArgumentsFactory.createArgument(ArgumentsFactory.java:50)
    at ch.lambdaj.function.argument.ArgumentsFactory.createArgument(ArgumentsFactory.java:39)
    at ch.lambdaj.Lambda.on(Lambda.java:63)

What puzzles me is that I tried the very same code in a java console application and it worked...

Any idea why this wouldn't work on Android?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Apparently, lambdaj won't work on Android per the creator's words. https://groups.google.com/d/msg/lambdaj/km7uFgvSd3k/grJhgl3ik5sJ

After reading that I stopped trying to make it work myself.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...