Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-8274

I get a AndroidRuntime about Didn't find class "java.lang.ClassValue" while I use lucene 7.2,1 in android

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 7.2.1
    • Fix Version/s: None
    • Component/s: core/queryparser
    • Labels:
    • Environment:
    • Lucene Fields:
      New

      Description

       

      I find that javaversion_1.8 can be use in android-26, so I try to replace lucene4.7.2 into lucene7.2.1 in my android project. but I get a AndroidRuntime

       

      This is my config:

      compileOptions

      { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }

       

      dependencies

      { compile 'com.android.support:multidex:1.0.1' compile 'org.apache.lucene:lucene-core:7.2.1' compile 'org.apache.lucene:lucene-analyzers-common:7.2.1' compile 'org.apache.lucene:lucene-analyzers-smartcn:7.2.1' compile 'org.apache.lucene:lucene-queries:7.2.1' compile 'org.apache.lucene:lucene-queryparser:7.2.1' }

       

      it goes well when Build APK , but got a AndroidRuntime like below:

      04-25 10:20:15.129 13251 13273 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/ClassValue;
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.analysis.standard.StandardAnalyzer.createComponents(StandardAnalyzer.java:103)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.analysis.AnalyzerWrapper.createComponents(AnalyzerWrapper.java:134)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.analysis.Analyzer.tokenStream(Analyzer.java:198)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.util.QueryBuilder.createFieldQuery(QueryBuilder.java:240)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.queryparser.classic.QueryParserBase.newFieldQuery(QueryParserBase.java:475)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.queryparser.classic.QueryParserBase.getFieldQuery(QueryParserBase.java:467)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.queryparser.classic.MultiFieldQueryParser.getFieldQuery(MultiFieldQueryParser.java:154)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.queryparser.classic.QueryParserBase.handleBareTokenQuery(QueryParserBase.java:830)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.queryparser.classic.QueryParser.Term(QueryParser.java:469)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.queryparser.classic.QueryParser.Clause(QueryParser.java:355)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.queryparser.classic.QueryParser.Query(QueryParser.java:244)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:215)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:109)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at com.android.globalsearch.model.index.ContactsIndexHelper.getQuery(ContactsIndexHelper.java:713)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at com.android.globalsearch.model.index.IndexHelper.initQuery(IndexHelper.java:496)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at com.android.globalsearch.model.task.search.SearchLocalTask$4.run(SearchLocalTask.java:342)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at java.lang.Thread.run(Thread.java:764)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "java.lang.ClassValue" on path: DexPathList[[zip file "/data/app/com.android.globalsearch-1nMSgWTRPQ5vt_9Co6iFaw==/base.apk"],nativeLibraryDirectories=[/data/app/com.android.globalsearch-1nMSgWTRPQ5vt_9Co6iFaw==/lib/arm, /data/app/com.andriod.globalsearch-1nMSgWTRPQ5vt_9Co6iFaw==/base.apk!/lib/armeabi, /system/lib, /vendor/lib]]
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
      04-25 10:20:15.129 13251 13273 E AndroidRuntime: ... 19 more

       

      这个问题跟stackoverflow上的这个问题一样:

      https://stackoverflow.com/questions/47657615/lucene-android-noclassdeffounderror

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              punk zhangzhenan
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: