方法引用过多 - 在 Android Studio 中使用 AppEngine SDK
Too many method references - using AppEngine SDK in Android Studio
我正在为我的 Android 应用程序使用 App Engine 端点。问题是在使用 Endpoints 并添加另一个 SDK 后出现以下错误:
trouble writing output: Too many method references: 116924; max is 65536.
You may try using --multi-dex option.
References by package:
23 com.google.appengine.api
1540 com.google.appengine.api.appidentity
22 com.google.appengine.api.backends
1421 com.google.appengine.api.blobstore
4 com.google.appengine.api.blobstore.proto2api
795 com.google.appengine.api.capabilities
352 com.google.appengine.api.channel
2374 com.google.appengine.api.datastore
5231 com.google.appengine.api.files
2950 com.google.appengine.api.images
174 com.google.appengine.api.log
722 com.google.appengine.api.mail
4 com.google.appengine.api.mail.proto2api
10 com.google.appengine.api.mail.stdimpl
3711 com.google.appengine.api.memcache
48 com.google.appengine.api.memcache.stdimpl
2178 com.google.appengine.api.modules
38 com.google.appengine.api.oauth
1497 com.google.appengine.api.prospectivesearch
8 com.google.appengine.api.prospectivesearch.proto2api
27 com.google.appengine.api.quota
14 com.google.appengine.api.rdbms
606 com.google.appengine.api.search
79 com.google.appengine.api.search.checkers
381 com.google.appengine.api.search.query
3724 com.google.appengine.api.socket
4 com.google.appengine.api.socket.proto2api
5443 com.google.appengine.api.taskqueue
4 com.google.appengine.api.taskqueue.proto2api
966 com.google.appengine.api.urlfetch
43 com.google.appengine.api.users
44 com.google.appengine.api.utils
1463 com.google.appengine.api.xmpp
4 com.google.appengine.api.xmpp.proto2api
5480 com.google.appengine.repackaged.com.google.appengine.api.search
1243 com.google.appengine.repackaged.com.google.common.base
7 com.google.appengine.repackaged.com.google.common.base.internal
8524 com.google.appengine.repackaged.com.google.common.collect
103 com.google.appengine.repackaged.com.google.common.escape
379 com.google.appengine.repackaged.com.google.common.flags
642 com.google.appengine.repackaged.com.google.common.hash
1 com.google.appengine.repackaged.com.google.common.html
578 com.google.appengine.repackaged.com.google.common.io
103 com.google.appengine.repackaged.com.google.common.math
39 com.google.appengine.repackaged.com.google.common.net
2 com.google.appengine.repackaged.com.google.common.parameterset
556 com.google.appengine.repackaged.com.google.common.primitives
36 com.google.appengine.repackaged.com.google.common.util
753 com.google.appengine.repackaged.com.google.common.util.concurrent
5 com.google.appengine.repackaged.com.google.common.xml
290 com.google.appengine.repackaged.com.google.io.base
177 com.google.appengine.repackaged.com.google.io.base.shell
1348 com.google.appengine.repackaged.com.google.io.protocol
1752 com.google.appengine.repackaged.com.google.io.protocol.proto
8 com.google.appengine.repackaged.com.google.io.protocol.proto.proto2api
4 com.google.appengine.repackaged.com.google.io.protocol.proto2
24 com.google.appengine.repackaged.com.google.net.base
25 com.google.appengine.repackaged.com.google.net.util.error
10402 com.google.appengine.repackaged.com.google.protobuf
191 com.google.appengine.repackaged.com.google.protobuf.bridge
12 com.google.appengine.repackaged.com.google.protobuf.contrib.descriptor_pool
51 com.google.appengine.repackaged.com.google.protobuf.contrib.htmlform
384 com.google.appengine.repackaged.com.google.protobuf.downgraded
1540 com.google.appengine.repackaged.com.google.protos.gdata.proto2api
8 com.google.appengine.repackaged.com.google.protos.proto2.bridge
3173 com.google.appengine.repackaged.com.google.storage.onestore.v3.proto2api
407 com.google.appengine.repackaged.org.antlr.runtime
368 com.google.appengine.repackaged.org.antlr.runtime.debug
43 com.google.appengine.repackaged.org.antlr.runtime.misc
422 com.google.appengine.repackaged.org.antlr.runtime.tree
2015 com.google.appengine.repackaged.org.joda.time
268 com.google.appengine.repackaged.org.joda.time.base
858 com.google.appengine.repackaged.org.joda.time.chrono
120 com.google.appengine.repackaged.org.joda.time.convert
533 com.google.appengine.repackaged.org.joda.time.field
540 com.google.appengine.repackaged.org.joda.time.format
178 com.google.appengine.repackaged.org.joda.time.tz
26 com.google.appengine.spi
1521 com.google.appengine.tools.appstats
39 com.google.appengine.tools.compilation
6283 com.google.apphosting.api
1971 com.google.apphosting.api.logservice
4 com.google.apphosting.api.logservice.proto2api
739 com.google.apphosting.api.proto2api
1688 com.google.apphosting.api.search
8 com.google.apphosting.base
207 com.google.apphosting.client.datastoreservice.app
102 com.google.apphosting.client.datastoreservice.app.mobile
1782 com.google.apphosting.client.datastoreservice.mobile
2343 com.google.apphosting.client.datastoreservice.proto
51 com.google.apphosting.client.serviceapp
6714 com.google.apphosting.datastore
705 com.google.apphosting.utils.remoteapi
59 com.google.apphosting.utils.servlet
785 com.google.cloud.sql.jdbc
532 com.google.cloud.sql.jdbc.internal
5 com.google.httputil
1 com.google.inject
1 com.google.inject.util
1 com.google.net.base
39 com.google.net.rpc
6 com.google.net.rpc.impl
6 com.google.net.rpc3.client
1 com.google.net.rpc3.impl
3 com.google.net.rpc3.impl.compatibility
1 com.google.net.rpc3.impl.server
5 com.google.net.rpc3.server
1 com.google.net.ssl
6099 com.google.protos.cloud.sql
10 com.google.storage.onestore
2287 com.google.storage.onestore.v3
3 default
5 it.unimi.dsi.fastutil.ints
6 java.awt.datatransfer
10 java.beans
226 java.io
438 java.lang
13 java.lang.ref
36 java.lang.reflect
28 java.math
73 java.net
68 java.nio
7 java.nio.channels
16 java.nio.charset
16 java.security
40 java.sql
34 java.text
520 java.util
129 java.util.concurrent
26 java.util.concurrent.atomic
37 java.util.concurrent.locks
14 java.util.logging
18 java.util.regex
5 java.util.zip
163 javax.activation
13 javax.annotation.processing
49 javax.cache
1 javax.lang.model
19 javax.lang.model.element
4 javax.lang.model.type
4 javax.lang.model.util
405 javax.mail
59 javax.mail.event
502 javax.mail.internet
108 javax.mail.search
45 javax.mail.util
1 javax.net.ssl
6 javax.servlet
26 javax.servlet.http
2 javax.tools
3 org.antlr.stringtemplate
23 org.apache.geronimo.mail.handlers
190 org.apache.geronimo.mail.util
4 org.xml.sax
2 org.xml.sax.helpers
6 sun.misc
如您所见,com.google.appengine 占用了大部分方法引用。我该如何限制它?
你点击了 65k method limit,你可以做一些选择。
在您的 gradle 文件中您可以指定 minifyEnabled = true
它将减少未使用的资源和代码。
您还可以使用 SDK 构建工具 21.1.X
支持使用依赖项创建多 dex 文件
compile 'com.android.support:multidex:1.0.0'
同时将 multiDexEnabled true
添加到您的 gradle。可以找到更多信息 here
我正在为我的 Android 应用程序使用 App Engine 端点。问题是在使用 Endpoints 并添加另一个 SDK 后出现以下错误:
trouble writing output: Too many method references: 116924; max is 65536.
You may try using --multi-dex option.
References by package:
23 com.google.appengine.api
1540 com.google.appengine.api.appidentity
22 com.google.appengine.api.backends
1421 com.google.appengine.api.blobstore
4 com.google.appengine.api.blobstore.proto2api
795 com.google.appengine.api.capabilities
352 com.google.appengine.api.channel
2374 com.google.appengine.api.datastore
5231 com.google.appengine.api.files
2950 com.google.appengine.api.images
174 com.google.appengine.api.log
722 com.google.appengine.api.mail
4 com.google.appengine.api.mail.proto2api
10 com.google.appengine.api.mail.stdimpl
3711 com.google.appengine.api.memcache
48 com.google.appengine.api.memcache.stdimpl
2178 com.google.appengine.api.modules
38 com.google.appengine.api.oauth
1497 com.google.appengine.api.prospectivesearch
8 com.google.appengine.api.prospectivesearch.proto2api
27 com.google.appengine.api.quota
14 com.google.appengine.api.rdbms
606 com.google.appengine.api.search
79 com.google.appengine.api.search.checkers
381 com.google.appengine.api.search.query
3724 com.google.appengine.api.socket
4 com.google.appengine.api.socket.proto2api
5443 com.google.appengine.api.taskqueue
4 com.google.appengine.api.taskqueue.proto2api
966 com.google.appengine.api.urlfetch
43 com.google.appengine.api.users
44 com.google.appengine.api.utils
1463 com.google.appengine.api.xmpp
4 com.google.appengine.api.xmpp.proto2api
5480 com.google.appengine.repackaged.com.google.appengine.api.search
1243 com.google.appengine.repackaged.com.google.common.base
7 com.google.appengine.repackaged.com.google.common.base.internal
8524 com.google.appengine.repackaged.com.google.common.collect
103 com.google.appengine.repackaged.com.google.common.escape
379 com.google.appengine.repackaged.com.google.common.flags
642 com.google.appengine.repackaged.com.google.common.hash
1 com.google.appengine.repackaged.com.google.common.html
578 com.google.appengine.repackaged.com.google.common.io
103 com.google.appengine.repackaged.com.google.common.math
39 com.google.appengine.repackaged.com.google.common.net
2 com.google.appengine.repackaged.com.google.common.parameterset
556 com.google.appengine.repackaged.com.google.common.primitives
36 com.google.appengine.repackaged.com.google.common.util
753 com.google.appengine.repackaged.com.google.common.util.concurrent
5 com.google.appengine.repackaged.com.google.common.xml
290 com.google.appengine.repackaged.com.google.io.base
177 com.google.appengine.repackaged.com.google.io.base.shell
1348 com.google.appengine.repackaged.com.google.io.protocol
1752 com.google.appengine.repackaged.com.google.io.protocol.proto
8 com.google.appengine.repackaged.com.google.io.protocol.proto.proto2api
4 com.google.appengine.repackaged.com.google.io.protocol.proto2
24 com.google.appengine.repackaged.com.google.net.base
25 com.google.appengine.repackaged.com.google.net.util.error
10402 com.google.appengine.repackaged.com.google.protobuf
191 com.google.appengine.repackaged.com.google.protobuf.bridge
12 com.google.appengine.repackaged.com.google.protobuf.contrib.descriptor_pool
51 com.google.appengine.repackaged.com.google.protobuf.contrib.htmlform
384 com.google.appengine.repackaged.com.google.protobuf.downgraded
1540 com.google.appengine.repackaged.com.google.protos.gdata.proto2api
8 com.google.appengine.repackaged.com.google.protos.proto2.bridge
3173 com.google.appengine.repackaged.com.google.storage.onestore.v3.proto2api
407 com.google.appengine.repackaged.org.antlr.runtime
368 com.google.appengine.repackaged.org.antlr.runtime.debug
43 com.google.appengine.repackaged.org.antlr.runtime.misc
422 com.google.appengine.repackaged.org.antlr.runtime.tree
2015 com.google.appengine.repackaged.org.joda.time
268 com.google.appengine.repackaged.org.joda.time.base
858 com.google.appengine.repackaged.org.joda.time.chrono
120 com.google.appengine.repackaged.org.joda.time.convert
533 com.google.appengine.repackaged.org.joda.time.field
540 com.google.appengine.repackaged.org.joda.time.format
178 com.google.appengine.repackaged.org.joda.time.tz
26 com.google.appengine.spi
1521 com.google.appengine.tools.appstats
39 com.google.appengine.tools.compilation
6283 com.google.apphosting.api
1971 com.google.apphosting.api.logservice
4 com.google.apphosting.api.logservice.proto2api
739 com.google.apphosting.api.proto2api
1688 com.google.apphosting.api.search
8 com.google.apphosting.base
207 com.google.apphosting.client.datastoreservice.app
102 com.google.apphosting.client.datastoreservice.app.mobile
1782 com.google.apphosting.client.datastoreservice.mobile
2343 com.google.apphosting.client.datastoreservice.proto
51 com.google.apphosting.client.serviceapp
6714 com.google.apphosting.datastore
705 com.google.apphosting.utils.remoteapi
59 com.google.apphosting.utils.servlet
785 com.google.cloud.sql.jdbc
532 com.google.cloud.sql.jdbc.internal
5 com.google.httputil
1 com.google.inject
1 com.google.inject.util
1 com.google.net.base
39 com.google.net.rpc
6 com.google.net.rpc.impl
6 com.google.net.rpc3.client
1 com.google.net.rpc3.impl
3 com.google.net.rpc3.impl.compatibility
1 com.google.net.rpc3.impl.server
5 com.google.net.rpc3.server
1 com.google.net.ssl
6099 com.google.protos.cloud.sql
10 com.google.storage.onestore
2287 com.google.storage.onestore.v3
3 default
5 it.unimi.dsi.fastutil.ints
6 java.awt.datatransfer
10 java.beans
226 java.io
438 java.lang
13 java.lang.ref
36 java.lang.reflect
28 java.math
73 java.net
68 java.nio
7 java.nio.channels
16 java.nio.charset
16 java.security
40 java.sql
34 java.text
520 java.util
129 java.util.concurrent
26 java.util.concurrent.atomic
37 java.util.concurrent.locks
14 java.util.logging
18 java.util.regex
5 java.util.zip
163 javax.activation
13 javax.annotation.processing
49 javax.cache
1 javax.lang.model
19 javax.lang.model.element
4 javax.lang.model.type
4 javax.lang.model.util
405 javax.mail
59 javax.mail.event
502 javax.mail.internet
108 javax.mail.search
45 javax.mail.util
1 javax.net.ssl
6 javax.servlet
26 javax.servlet.http
2 javax.tools
3 org.antlr.stringtemplate
23 org.apache.geronimo.mail.handlers
190 org.apache.geronimo.mail.util
4 org.xml.sax
2 org.xml.sax.helpers
6 sun.misc
如您所见,com.google.appengine 占用了大部分方法引用。我该如何限制它?
你点击了 65k method limit,你可以做一些选择。
在您的 gradle 文件中您可以指定 minifyEnabled = true
它将减少未使用的资源和代码。
您还可以使用 SDK 构建工具 21.1.X
支持使用依赖项创建多 dex 文件
compile 'com.android.support:multidex:1.0.0'
同时将 multiDexEnabled true
添加到您的 gradle。可以找到更多信息 here