求助,android里lucene 4.3的一个错误

zhuhellozhu 2013-05-17 05:37:13
在android里lucene从3.6升级到4.x之后,报了一个运行错误。

从错误提示看是少了什么文件,网上搜了一把,解决办法好像是把META-INF/services/目录拷过来。

我照着java工程的例子在android加了这个文件夹,但是并没有起作用。

错误是这样的:

05-17 09:19:40.818: E/AndroidRuntime(797): FATAL EXCEPTION: main
05-17 09:19:40.818: E/AndroidRuntime(797): java.lang.ExceptionInInitializerError
05-17 09:19:40.818: E/AndroidRuntime(797): at org.apache.lucene.index.LiveIndexWriterConfig.<init>(LiveIndexWriterConfig.java:118)
05-17 09:19:40.818: E/AndroidRuntime(797): at org.apache.lucene.index.IndexWriterConfig.<init>(IndexWriterConfig.java:144)
05-17 09:19:40.818: E/AndroidRuntime(797): at com.example.lucene43.MainActivity.CreateFileIndexer(MainActivity.java:85)
05-17 09:19:40.818: E/AndroidRuntime(797): at com.example.lucene43.MainActivity.onCreate(MainActivity.java:53)
05-17 09:19:40.818: E/AndroidRuntime(797): at android.app.Activity.performCreate(Activity.java:5104)
05-17 09:19:40.818: E/AndroidRuntime(797): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
05-17 09:19:40.818: E/AndroidRuntime(797): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
05-17 09:19:40.818: E/AndroidRuntime(797): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
05-17 09:19:40.818: E/AndroidRuntime(797): at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-17 09:19:40.818: E/AndroidRuntime(797): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
05-17 09:19:40.818: E/AndroidRuntime(797): at android.os.Handler.dispatchMessage(Handler.java:99)
05-17 09:19:40.818: E/AndroidRuntime(797): at android.os.Looper.loop(Looper.java:137)
05-17 09:19:40.818: E/AndroidRuntime(797): at android.app.ActivityThread.main(ActivityThread.java:5041)
05-17 09:19:40.818: E/AndroidRuntime(797): at java.lang.reflect.Method.invokeNative(Native Method)
05-17 09:19:40.818: E/AndroidRuntime(797): at java.lang.reflect.Method.invoke(Method.java:511)
05-17 09:19:40.818: E/AndroidRuntime(797): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-17 09:19:40.818: E/AndroidRuntime(797): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-17 09:19:40.818: E/AndroidRuntime(797): at dalvik.system.NativeStart.main(Native Method)
05-17 09:19:40.818: E/AndroidRuntime(797): Caused by: java.lang.IllegalArgumentException: A SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene42' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath.The current classpath supports the following names: []
05-17 09:19:40.818: E/AndroidRuntime(797): at org.apache.lucene.util.NamedSPILoader.lookup(NamedSPILoader.java:109)
05-17 09:19:40.818: E/AndroidRuntime(797): at org.apache.lucene.codecs.Codec.forName(Codec.java:95)
05-17 09:19:40.818: E/AndroidRuntime(797): at org.apache.lucene.codecs.Codec.<clinit>(Codec.java:122)
05-17 09:19:40.818: E/AndroidRuntime(797): ... 18 more


别人修改的方法大概是这样的:


我不清楚是不是android打包方式的不同导致的。

刚转到android,还只会照葫芦画瓢,还请大家帮忙。
...全文
39 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

58,454

社区成员

发帖
与我相关
我的任务
社区描述
Java Eclipse
社区管理员
  • Eclipse
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧