Android Question Error in compilation: Too many method references

MarcoRome

Expert
Licensed User
Hi all.I have this error when i compile:

Convert byte code - optimized dex. Error
trouble writing output: Too many method references: 67033; max is 65536.
You may try using --multi-dex option.

any solution ?
Thank you
Marco
 

MarcoRome

Expert
Licensed User
Not yet, i'm looking for how to use this option.
How can i use --multi-dex in B4A ?
Any help
 
Upvote 0

MarcoRome

Expert
Licensed User
Hi Erel.
If you add a "few" jar - Libraries - and you have refence > 65536 boomm have problem
Do you have solution for this problem ?
Thank you
Marco
 
Upvote 0

Erel

Administrator
Staff member
Licensed User
MultiDex is currently not supported.

Which libraries are you using?

I wasn't able to reproduce it. Tested with these libraries:
SS-2015-10-06_17.26.00.png
 
Upvote 0

MarcoRome

Expert
Licensed User
Hi Erel.

B4X:
B4A version: 5.20
Parsing code.    (0.04s)
Compiling code.    (0.24s)
   
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.    (0.14s)
Generating R file.    (17.89s)
Compiling generated Java code.    (26.86s)
Convert byte code - optimized dex.    Error
trouble writing output: Too many method references: 67033; max is 65536.
You may try using --multi-dex option.
References by package:
     6 android.accessibilityservice
     5 android.accounts
    22 android.animation
   498 android.app
     3 android.appwidget
   197 android.content
    35 android.content.pm
   100 android.content.res
    55 android.database
    17 android.database.sqlite
   197 android.graphics
    92 android.graphics.drawable
     2 android.graphics.drawable.shapes
     3 android.graphics.pdf
    26 android.hardware
     6 android.hardware.display
     6 android.location
   168 android.media
    85 android.media.session
    59 android.net
     4 android.net.http
     1 android.opengl
   236 android.os
     1 android.preference
    17 android.print
     5 android.print.pdf
    17 android.provider
     6 android.speech.tts
    20 android.support.annotation
    41 android.support.v4.accessibilityservice
    58 android.support.v4.animation
  1421 android.support.v4.app
   222 android.support.v4.content
     1 android.support.v4.content.pm
     8 android.support.v4.content.res
     3 android.support.v4.database
    39 android.support.v4.graphics
   169 android.support.v4.graphics.drawable
    19 android.support.v4.hardware.display
    74 android.support.v4.internal.view
   246 android.support.v4.media
    96 android.support.v4.media.routing
   799 android.support.v4.media.session
    64 android.support.v4.net
    27 android.support.v4.os
    82 android.support.v4.print
    96 android.support.v4.provider
    14 android.support.v4.speech.tts
    88 android.support.v4.text
   282 android.support.v4.util
  1719 android.support.v4.view
   889 android.support.v4.view.accessibility
    29 android.support.v4.view.animation
  1246 android.support.v4.widget
   608 android.support.v7.app
    16 android.support.v7.appcompat
    38 android.support.v7.graphics.drawable
     2 android.support.v7.internal
   275 android.support.v7.internal.app
     3 android.support.v7.internal.text
     2 android.support.v7.internal.transition
   128 android.support.v7.internal.view
   587 android.support.v7.internal.view.menu
  1213 android.support.v7.internal.widget
    10 android.support.v7.media
    25 android.support.v7.view
  1091 android.support.v7.widget
    16 android.telephony
    48 android.text
     4 android.text.method
     4 android.text.style
    16 android.transition
    58 android.util
   653 android.view
   175 android.view.accessibility
    31 android.view.animation
     2 android.view.inputmethod
    80 android.webkit
   616 android.widget
   191 anywheresoftware.b4a
    66 anywheresoftware.b4a.agraham.reflection
     1 anywheresoftware.b4a.debug
   239 anywheresoftware.b4a.keywords
    10 anywheresoftware.b4a.keywords.constants
   752 anywheresoftware.b4a.objects
    90 anywheresoftware.b4a.objects.collections
    97 anywheresoftware.b4a.objects.drawable
    67 anywheresoftware.b4a.objects.streams
   247 anywheresoftware.b4a.phone
    39 anywheresoftware.b4a.samples.httputils2
    66 anywheresoftware.b4h.okhttp
    26 anywheresoftware.b4j.object
   197 com.devil.app.vinolife
    12 com.devil.app.vinolife.designerscripts
    31 com.google.ads
    58 com.google.ads.mediation
     2 com.google.ads.mediation.admob
    41 com.google.ads.mediation.customevent
    16 com.google.android.gms
     4 com.google.android.gms.actions
   121 com.google.android.gms.ads
    84 com.google.android.gms.ads.doubleclick
    94 com.google.android.gms.ads.formats
    22 com.google.android.gms.ads.identifier
   292 com.google.android.gms.ads.internal
   407 com.google.android.gms.ads.internal.client
    82 com.google.android.gms.ads.internal.formats
   182 com.google.android.gms.ads.internal.overlay
    93 com.google.android.gms.ads.internal.purchase
   173 com.google.android.gms.ads.internal.request
   120 com.google.android.gms.ads.internal.reward.client
    61 com.google.android.gms.ads.internal.reward.mediation.client
    39 com.google.android.gms.ads.internal.util.client
    25 com.google.android.gms.ads.mediation
     2 com.google.android.gms.ads.mediation.admob
    48 com.google.android.gms.ads.mediation.customevent
    16 com.google.android.gms.ads.purchase
    19 com.google.android.gms.ads.reward
    14 com.google.android.gms.ads.reward.mediation
    81 com.google.android.gms.ads.search
   295 com.google.android.gms.analytics
    37 com.google.android.gms.analytics.ecommerce
   737 com.google.android.gms.analytics.internal
   135 com.google.android.gms.appdatasearch
    52 com.google.android.gms.appindexing
    26 com.google.android.gms.appinvite
   117 com.google.android.gms.appstate
    78 com.google.android.gms.auth
    19 com.google.android.gms.auth.api
    70 com.google.android.gms.auth.api.credentials
    98 com.google.android.gms.auth.api.credentials.internal
    21 com.google.android.gms.auth.api.proxy
   704 com.google.android.gms.cast
    55 com.google.android.gms.cast.games
   300 com.google.android.gms.cast.internal
   521 com.google.android.gms.common
   487 com.google.android.gms.common.api
   142 com.google.android.gms.common.data
   100 com.google.android.gms.common.images
   529 com.google.android.gms.common.internal
    76 com.google.android.gms.common.internal.safeparcel
    10 com.google.android.gms.common.server
    45 com.google.android.gms.common.server.converter
   132 com.google.android.gms.common.server.response
    43 com.google.android.gms.common.stats
   300 com.google.android.gms.drive
   134 com.google.android.gms.drive.events
  1103 com.google.android.gms.drive.internal
    41 com.google.android.gms.drive.metadata
   159 com.google.android.gms.drive.metadata.internal
    84 com.google.android.gms.drive.query
   183 com.google.android.gms.drive.query.internal
   325 com.google.android.gms.drive.realtime.internal
   110 com.google.android.gms.drive.realtime.internal.event
    18 com.google.android.gms.drive.widget
   213 com.google.android.gms.dynamic
    56 com.google.android.gms.fitness
   483 com.google.android.gms.fitness.data
    36 com.google.android.gms.fitness.internal.service
   726 com.google.android.gms.fitness.request
   222 com.google.android.gms.fitness.result
    42 com.google.android.gms.fitness.service
   342 com.google.android.gms.games
   109 com.google.android.gms.games.achievement
   343 com.google.android.gms.games.appcontent
    77 com.google.android.gms.games.event
  1481 com.google.android.gms.games.internal
   653 com.google.android.gms.games.internal.api
    32 com.google.android.gms.games.internal.constants
     2 com.google.android.gms.games.internal.data
    12 com.google.android.gms.games.internal.events
     8 com.google.android.gms.games.internal.experience
    75 com.google.android.gms.games.internal.game
    26 com.google.android.gms.games.internal.multiplayer
    16 com.google.android.gms.games.internal.notification
    51 com.google.android.gms.games.internal.player
    40 com.google.android.gms.games.internal.request
   214 com.google.android.gms.games.leaderboard
   187 com.google.android.gms.games.multiplayer
   170 com.google.android.gms.games.multiplayer.realtime
   192 com.google.android.gms.games.multiplayer.turnbased
   173 com.google.android.gms.games.quest
    98 com.google.android.gms.games.request
   189 com.google.android.gms.games.snapshot
   196 com.google.android.gms.gcm
    34 com.google.android.gms.identity.intents
    41 com.google.android.gms.identity.intents.model
   113 com.google.android.gms.iid
  5946 com.google.android.gms.internal
   297 com.google.android.gms.location
    13 com.google.android.gms.location.copresence.internal
   376 com.google.android.gms.location.internal
   268 com.google.android.gms.location.places
   397 com.google.android.gms.location.places.internal
    67 com.google.android.gms.location.places.personalized
    14 com.google.android.gms.location.places.personalized.internal
     7 com.google.android.gms.location.places.ui
   547 com.google.android.gms.maps
   834 com.google.android.gms.maps.internal
   504 com.google.android.gms.maps.model
   505 com.google.android.gms.maps.model.internal
     2 com.google.android.gms.nearby
    15 com.google.android.gms.nearby.bootstrap
   106 com.google.android.gms.nearby.bootstrap.request
    51 com.google.android.gms.nearby.connection
    50 com.google.android.gms.nearby.messages
   127 com.google.android.gms.nearby.messages.internal
    67 com.google.android.gms.nearby.sharing
   110 com.google.android.gms.nearby.sharing.internal
     9 com.google.android.gms.panorama
    74 com.google.android.gms.playlog.internal
    98 com.google.android.gms.plus
   221 com.google.android.gms.plus.internal
   175 com.google.android.gms.plus.internal.model.moments
   370 com.google.android.gms.plus.internal.model.people
   185 com.google.android.gms.plus.model.moments
   120 com.google.android.gms.plus.model.people
    19 com.google.android.gms.safetynet
    22 com.google.android.gms.search
    12 com.google.android.gms.security
   100 com.google.android.gms.signin.internal
   955 com.google.android.gms.tagmanager
   402 com.google.android.gms.wallet
    48 com.google.android.gms.wallet.firstparty
   255 com.google.android.gms.wallet.fragment
   114 com.google.android.gms.wallet.wobs
   299 com.google.android.gms.wearable
  1173 com.google.android.gms.wearable.internal
   268 com.google.android.youtube.player
   721 com.google.android.youtube.player.internal
   140 com.google.zxing
    16 com.google.zxing.aztec
    18 com.google.zxing.aztec.decoder
    26 com.google.zxing.aztec.detector
    59 com.google.zxing.aztec.encoder
   273 com.google.zxing.client.result
   109 com.google.zxing.common
    14 com.google.zxing.common.detector
    36 com.google.zxing.common.reedsolomon
    12 com.google.zxing.datamatrix
    59 com.google.zxing.datamatrix.decoder
    19 com.google.zxing.datamatrix.detector
   120 com.google.zxing.datamatrix.encoder
     6 com.google.zxing.maxicode
    18 com.google.zxing.maxicode.decoder
    11 com.google.zxing.multi
     5 com.google.zxing.multi.qrcode
    18 com.google.zxing.multi.qrcode.detector
   169 com.google.zxing.oned
    59 com.google.zxing.oned.rss
    56 com.google.zxing.oned.rss.expanded
   114 com.google.zxing.oned.rss.expanded.decoders
    32 com.google.zxing.pdf417
   125 com.google.zxing.pdf417.decoder
    31 com.google.zxing.pdf417.decoder.ec
    14 com.google.zxing.pdf417.detector
    55 com.google.zxing.pdf417.encoder
    12 com.google.zxing.qrcode
   110 com.google.zxing.qrcode.decoder
    59 com.google.zxing.qrcode.detector
    80 com.google.zxing.qrcode.encoder
   160 com.maximussoft.msmaterialdrawer
     1 com.mchange.v2.c3p0
    25 com.mikepenz.google_material_typeface_library
   117 com.mikepenz.iconics
    42 com.mikepenz.iconics.typeface
     7 com.mikepenz.iconics.utils
    28 com.mikepenz.iconics.view
   178 com.mikepenz.materialdrawer
    89 com.mikepenz.materialdrawer.accountswitcher
    25 com.mikepenz.materialdrawer.adapter
   501 com.mikepenz.materialdrawer.model
    55 com.mikepenz.materialdrawer.model.interfaces
    62 com.mikepenz.materialdrawer.util
    89 com.mikepenz.materialdrawer.view
    93 com.mysql.fabric
     9 com.mysql.fabric.hibernate
   478 com.mysql.fabric.jdbc
    48 com.mysql.fabric.proto.xmlrpc
     4 com.mysql.fabric.xmlrpc
    76 com.mysql.fabric.xmlrpc.base
     5 com.mysql.fabric.xmlrpc.exceptions
  6355 com.mysql.jdbc
    34 com.mysql.jdbc.authentication
    48 com.mysql.jdbc.exceptions
    50 com.mysql.jdbc.exceptions.jdbc4
     5 com.mysql.jdbc.integration.c3p0
     4 com.mysql.jdbc.integration.jboss
    25 com.mysql.jdbc.interceptors
   920 com.mysql.jdbc.jdbc2.optional
    52 com.mysql.jdbc.jmx
   107 com.mysql.jdbc.log
    26 com.mysql.jdbc.profiler
    62 com.mysql.jdbc.util
    12 com.nostra13.universalimageloader.cache.disc
    28 com.nostra13.universalimageloader.cache.disc.impl
   117 com.nostra13.universalimageloader.cache.disc.impl.ext
     6 com.nostra13.universalimageloader.cache.disc.naming
    30 com.nostra13.universalimageloader.cache.memory
    72 com.nostra13.universalimageloader.cache.memory.impl
   269 com.nostra13.universalimageloader.core
    51 com.nostra13.universalimageloader.core.assist
   132 com.nostra13.universalimageloader.core.assist.deque
    27 com.nostra13.universalimageloader.core.decode
    20 com.nostra13.universalimageloader.core.display
    23 com.nostra13.universalimageloader.core.download
    40 com.nostra13.universalimageloader.core.imageaware
    14 com.nostra13.universalimageloader.core.listener
     1 com.nostra13.universalimageloader.core.process
    47 com.nostra13.universalimageloader.utils
    54 com.socialnetis.youtube
   666 com.squareup.okhttp
   212 com.squareup.okhttp.internal
   260 com.squareup.okhttp.internal.http
    18 com.squareup.okhttp.internal.io
   412 com.squareup.okhttp.internal.spdy
    19 com.squareup.okhttp.internal.tls
   536 com.squareup.picasso
     2 dalvik.system
    59 de.donmanfred
    47 de.donmanfred.b4a
     6 default
    32 ice.zxing
    56 ice.zxing.camera
    43 ice.zxing.decoding
    10 ice.zxing.view
   207 java.io
   437 java.lang
    13 java.lang.management
     9 java.lang.ref
    33 java.lang.reflect
    30 java.math
   106 java.net
    40 java.nio
     5 java.nio.channels
     9 java.nio.charset
     2 java.nio.file
     2 java.rmi.server
    31 java.security
    10 java.security.cert
     2 java.security.spec
   370 java.sql
    35 java.text
   369 java.util
    88 java.util.concurrent
    20 java.util.concurrent.atomic
    14 java.util.concurrent.locks
     7 java.util.logging
    21 java.util.regex
    37 java.util.zip
     4 javax.crypto
     2 javax.crypto.spec
     2 javax.management
     7 javax.naming
     2 javax.net
    26 javax.net.ssl
     1 javax.security.auth.x500
     8 javax.sql
    12 javax.transaction.xa
     4 javax.xml.datatype
     7 javax.xml.parsers
     7 javax.xml.stream
     3 javax.xml.transform
     3 javax.xml.transform.dom
     2 javax.xml.transform.sax
     2 javax.xml.transform.stax
     2 javax.xml.transform.stream
   487 okio
    18 org.apache.http
     3 org.apache.http.client
    14 org.apache.http.client.methods
     1 org.apache.http.client.utils
     1 org.apache.http.conn
     6 org.apache.http.entity
     2 org.apache.http.impl.client
     2 org.apache.http.impl.cookie
     6 org.apache.http.message
     3 org.apache.http.params
     1 org.gjt.mm.mysql
     2 org.jboss.resource.adapter.jdbc.vendor
    54 org.json
    16 org.slf4j
     5 org.xml.sax
     1 org.xml.sax.helpers
    12 org.xmlpull.v1
     2 vb.connect.Mywifi

Immagine.jpg
 
Upvote 0

MarcoRome

Expert
Licensed User
mmh... i see. Don what you think it is possibile delete folder "jdbc" into mysql-connector-java-5.1.34-bin.jar or have problem with your library ?
 
Upvote 0

DonManfred

Expert
Licensed User
Don what you think it is possibile delete folder "jdbc" into mysql-connector-java-5.1.34-bin.jar
i think you cannot delete the hole folder as some parts are needed from them. the jar is not from me so i cannot answer this really. You just can try to remove parts of it, recompile and see the new result (and if it works!). Remove more....

As alternative you can try to use the MariaDB library instead of the msMySQL one. It is MUCH less in size (and i believe the method list is more less too ;-))
 
Upvote 0

warwound

Expert
Licensed User
You currently have 67033 methods, max allowed is 65536.
67033 - 65536 = 1497

Look at the various Google Play Services packages:

16 com.google.android.gms
4 com.google.android.gms.actions
121 com.google.android.gms.ads
84 com.google.android.gms.ads.doubleclick
94 com.google.android.gms.ads.formats
22 com.google.android.gms.ads.identifier
292 com.google.android.gms.ads.internal
407 com.google.android.gms.ads.internal.client
82 com.google.android.gms.ads.internal.formats
182 com.google.android.gms.ads.internal.overlay
93 com.google.android.gms.ads.internal.purchase
173 com.google.android.gms.ads.internal.request
120 com.google.android.gms.ads.internal.reward.client
61 com.google.android.gms.ads.internal.reward.mediation.client
39 com.google.android.gms.ads.internal.util.client
25 com.google.android.gms.ads.mediation
2 com.google.android.gms.ads.mediation.admob
48 com.google.android.gms.ads.mediation.customevent
16 com.google.android.gms.ads.purchase
19 com.google.android.gms.ads.reward
14 com.google.android.gms.ads.reward.mediation
81 com.google.android.gms.ads.search
295 com.google.android.gms.analytics
37 com.google.android.gms.analytics.ecommerce
737 com.google.android.gms.analytics.internal
135 com.google.android.gms.appdatasearch
52 com.google.android.gms.appindexing
26 com.google.android.gms.appinvite
117 com.google.android.gms.appstate
78 com.google.android.gms.auth
19 com.google.android.gms.auth.api
70 com.google.android.gms.auth.api.credentials
98 com.google.android.gms.auth.api.credentials.internal
21 com.google.android.gms.auth.api.proxy
704 com.google.android.gms.cast
55 com.google.android.gms.cast.games
300 com.google.android.gms.cast.internal
521 com.google.android.gms.common
487 com.google.android.gms.common.api
142 com.google.android.gms.common.data
100 com.google.android.gms.common.images
529 com.google.android.gms.common.internal
76 com.google.android.gms.common.internal.safeparcel
10 com.google.android.gms.common.server
45 com.google.android.gms.common.server.converter
132 com.google.android.gms.common.server.response
43 com.google.android.gms.common.stats
300 com.google.android.gms.drive
134 com.google.android.gms.drive.events
1103 com.google.android.gms.drive.internal
41 com.google.android.gms.drive.metadata
159 com.google.android.gms.drive.metadata.internal
84 com.google.android.gms.drive.query
183 com.google.android.gms.drive.query.internal
325 com.google.android.gms.drive.realtime.internal
110 com.google.android.gms.drive.realtime.internal.event
18 com.google.android.gms.drive.widget
213 com.google.android.gms.dynamic
56 com.google.android.gms.fitness
483 com.google.android.gms.fitness.data
36 com.google.android.gms.fitness.internal.service
726 com.google.android.gms.fitness.request
222 com.google.android.gms.fitness.result
42 com.google.android.gms.fitness.service
342 com.google.android.gms.games
109 com.google.android.gms.games.achievement
343 com.google.android.gms.games.appcontent
77 com.google.android.gms.games.event
1481 com.google.android.gms.games.internal
653 com.google.android.gms.games.internal.api
32 com.google.android.gms.games.internal.constants
2 com.google.android.gms.games.internal.data
12 com.google.android.gms.games.internal.events
8 com.google.android.gms.games.internal.experience
75 com.google.android.gms.games.internal.game
26 com.google.android.gms.games.internal.multiplayer
16 com.google.android.gms.games.internal.notification
51 com.google.android.gms.games.internal.player
40 com.google.android.gms.games.internal.request
214 com.google.android.gms.games.leaderboard
187 com.google.android.gms.games.multiplayer
170 com.google.android.gms.games.multiplayer.realtime
192 com.google.android.gms.games.multiplayer.turnbased
173 com.google.android.gms.games.quest
98 com.google.android.gms.games.request
189 com.google.android.gms.games.snapshot
196 com.google.android.gms.gcm
34 com.google.android.gms.identity.intents
41 com.google.android.gms.identity.intents.model
113 com.google.android.gms.iid
5946 com.google.android.gms.internal
297 com.google.android.gms.location
13 com.google.android.gms.location.copresence.internal
376 com.google.android.gms.location.internal
268 com.google.android.gms.location.places
397 com.google.android.gms.location.places.internal
67 com.google.android.gms.location.places.personalized
14 com.google.android.gms.location.places.personalized.internal
7 com.google.android.gms.location.places.ui
547 com.google.android.gms.maps
834 com.google.android.gms.maps.internal
504 com.google.android.gms.maps.model
505 com.google.android.gms.maps.model.internal
2 com.google.android.gms.nearby
15 com.google.android.gms.nearby.bootstrap
106 com.google.android.gms.nearby.bootstrap.request
51 com.google.android.gms.nearby.connection
50 com.google.android.gms.nearby.messages
127 com.google.android.gms.nearby.messages.internal
67 com.google.android.gms.nearby.sharing
110 com.google.android.gms.nearby.sharing.internal
9 com.google.android.gms.panorama
74 com.google.android.gms.playlog.internal
98 com.google.android.gms.plus
221 com.google.android.gms.plus.internal
175 com.google.android.gms.plus.internal.model.moments
370 com.google.android.gms.plus.internal.model.people
185 com.google.android.gms.plus.model.moments
120 com.google.android.gms.plus.model.people
19 com.google.android.gms.safetynet
22 com.google.android.gms.search
12 com.google.android.gms.security
100 com.google.android.gms.signin.internal
955 com.google.android.gms.tagmanager
402 com.google.android.gms.wallet
48 com.google.android.gms.wallet.firstparty
255 com.google.android.gms.wallet.fragment
114 com.google.android.gms.wallet.wobs
299 com.google.android.gms.wearable
1173 com.google.android.gms.wearable.internal

I bet you're not using all of those packages?
Over 700 methods for Google Cast support.
Over 500 methods for Fit support.
What's tagmanager - it uses 955 methods?
Over 1400 methods for Wear support.

Can you create a copy of the Google Play Services library .jar file, remove unwanted packages and then compile using that modified .jar?
https://www.google.co.uk/search?q=g...ackages+from+jar&ie=UTF-8&oe=UTF-8&gws_rd=ssl

Not an elegant solution but it's a solution other have used in the past.
 
Upvote 0

susu

Well-Known Member
Licensed User
I have the same problem. Is there anyway to solve it yet? Thanks.
 
Upvote 0

susu

Well-Known Member
Licensed User
remove unused classes

See here (note that you need b4a v5.8+).

Thank you but I'm trying AdtoApp SDK. It uses Google Play Service and many ad network .jar files so I don't know which class is needed or not.
 
Upvote 0
Top