F
F
ftp272014-05-04 18:15:14
Android
ftp27, 2014-05-04 18:15:14

Too many method references in Android project

I'm building an Android project with NanoHTTPD. Error when building

Error Code:
  	2
  Output:
  	trouble writing output: Too many method references: 104051; max is 65536.
  	You may try using --multi-dex option.
  	References by package:
  	     8 default
  	     3 java.beans
  	   103 java.io
  	   366 java.lang
  	     2 java.lang.management
  	    16 java.lang.ref
  	    14 java.lang.reflect
  	    86 java.math
  	    18 java.net
  	     6 java.nio
  	     2 java.nio.channels
  	    14 java.nio.charset
  	     8 java.security
  	     2 java.text
  	   155 java.util
  	    30 java.util.concurrent
  	    19 java.util.concurrent.atomic
  	    20 java.util.concurrent.locks
  	    19 java.util.regex
  	     4 javax.xml.parsers
  	    24 org.xml.sax
  	    17 org.xml.sax.helpers
  	  8335 scala
  	  3784 scala.actors
  	  1244 scala.actors.remote
  	   384 scala.actors.scheduler
  	   570 scala.actors.threadpool
  	    48 scala.actors.threadpool.helpers
  	   159 scala.actors.threadpool.locks
  	    40 scala.annotation
  	     8 scala.annotation.target
  	     2 scala.annotation.unchecked
  	 19781 scala.collection
  	   785 scala.collection.generic
  	 18959 scala.collection.immutable
  	   171 scala.collection.interfaces
  	 15339 scala.collection.mutable
  	  8209 scala.collection.parallel
  	  2072 scala.collection.parallel.immutable
  	  1994 scala.collection.parallel.mutable
  	   171 scala.collection.script
  	    18 scala.compat
  	   483 scala.concurrent
  	   333 scala.concurrent.forkjoin
  	   893 scala.io
  	  1870 scala.math
  	    48 scala.parallel
  	   107 scala.ref
  	  1712 scala.reflect
  	  2415 scala.reflect.generic
  	  1542 scala.runtime
  	   474 scala.sys
  	   836 scala.sys.process
  	   182 scala.testing
  	   188 scala.text
  	   549 scala.util
  	   266 scala.util.automata
  	    98 scala.util.continuations
  	   502 scala.util.control
  	   110 scala.util.grammar
  	     6 scala.util.logging
  	   442 scala.util.matching
  	   358 scala.util.parsing.ast
  	   767 scala.util.parsing.combinator
  	   304 scala.util.parsing.combinator.lexical
  	    90 scala.util.parsing.combinator.syntactical
  	   213 scala.util.parsing.combinator.testing
  	   124 scala.util.parsing.combinator.token
  	   137 scala.util.parsing.input
  	   929 scala.util.parsing.json
  	     2 scala.util.parsing.syntax
  	   176 scala.util.regexp
  	  1859 scala.xml
  	  1190 scala.xml.dtd
  	   105 scala.xml.factory
  	    11 scala.xml.include
  	   112 scala.xml.include.sax
  	   948 scala.xml.parsing
  	   106 scala.xml.persistent
  	   444 scala.xml.pull
  	   100 scala.xml.transform
  	    11 sun.misc

Which is strange, since neither I nor Scala's nanohttpd uses
NanoHTTPD's hookup by editing build.gradle:
apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 17
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'org.kevoree.corelibrary.javase:org.kevoree.library.javase.nanohttp:2.0.5'
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
akira, 2014-06-02
@ftp27

There are too many methods, there are several solutions:
1) Remove libraries that are not used.
2) Use ProGuard to remove those methods that are not used.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question