android - Play Service 6.5.+ granular dependencies not working correctly -
update: per request, entire dependency declaration build.gradle, list of jars, , dependencies of included library projects listed @ bottom of quesion.
i'm working on project uses location, gcm, ads , identity components of google play services (version 7.0.0).
i've defined them such in build.gradle of app module:
compile 'com.google.android.gms:play-services-location:7.0.0' compile 'com.google.android.gms:play-services-ads:7.0.0' compile 'com.google.android.gms:play-services-identity:7.0.0' compile 'com.google.android.gms:play-services-gcm:7.0.0
note: don't know if it's relevant (i don't expect be), project includes 2 additional library modules, 1 of declares subset of above dependencies:
compile 'com.google.android.gms:play-services-location:7.0.0' compile 'com.google.android.gms:play-services-ads:7.0.0' compile 'com.google.android.gms:play-services-identity:7.0.0'
still, after trying build app, dexing fails due overstepping of 64k method count limit. bit suspicious of this, since before fine folk @ google introduced granular dependency management, used another, more crude approach, manually stripping away packages play services jar in gradle build task. worked fine, , 64k method limit not overstepped.
so now, begrudgingly introduced multi-dex project, able build .apk, , take @ method count package, using dex-method-counts command line tool, brought attention in a post jake wharton concerning unwieldiness of play services monolith.
these results:
google: 18687 ads: 127 mediation: 96 admob: 23 customevent: 41 android: 11873 gms: 11873 actions: 4 ads: 387 doubleclick: 84 identifier: 22 mediation: 75 admob: 2 customevent: 48 purchase: 16 search: 81 analytics: 656 ecommerce: 34 auth: 78 common: 1611 api: 409 data: 141 images: 100 internal: 580 safeparcel: 76 dynamic: 213 gcm: 35 identity: 86 intents: 75 model: 41 internal: 4914 location: 516 places: 232 ui: 7 maps: 2395 internal: 822 model: 1020 internal: 505 security: 12 tagmanager: 955 common: 5798 annotations: 3 base: 558 internal: 11 collect: 4195 io: 299 net: 72 primitives: 383 util: 288 concurrent: 288 gson: 889 annotations: 5 internal: 485 bind: 284 reflect: 18 stream: 102
tl;dr the play services listed having on 18k methods, , seem include components never defined dependencies in build.gradle (e.g. maps).
so then, dexed components use, 1 one, straight android-sdk-linux/extras/google/m2repository/com/google/android/gms/play-services-<component_name>
, using approach jake wharton's article referenced above.
the results follows:
base: read in 3592 method ids. <root>: 3592 : 6 android: 420 accounts: 5 app: 62 content: 71 pm: 12 res: 9 database: 21 graphics: 42 drawable: 21 net: 11 os: 102 support: 56 v4: 56 app: 45 content: 4 util: 7 text: 1 util: 22 view: 4 widget: 23 com: 2831 google: 2831 android: 2831 gms: 2831 actions: 4 auth: 78 common: 1611 api: 409 data: 141 images: 100 internal: 580 safeparcel: 76 dynamic: 213 internal: 913 security: 12 java: 324 io: 25 lang: 143 ref: 2 reflect: 13 math: 2 nio: 17 util: 137 concurrent: 26 atomic: 4 locks: 7 regex: 6 org: 11 json: 11 overall method count: 3592 --- location: read in 1554 method ids. <root>: 1554 android: 65 app: 1 content: 13 location: 3 net: 1 os: 41 text: 1 util: 5 com: 1417 google: 1417 android: 1417 gms: 1417 common: 75 api: 13 data: 8 internal: 53 safeparcel: 36 internal: 833 location: 505 places: 232 ui: 7 maps: 4 model: 4 java: 72 lang: 31 util: 41 concurrent: 1 overall method count: 1554 --- gcm: read in 72 method ids. <root>: 72 android: 27 app: 2 content: 16 pm: 1 os: 8 util: 1 com: 24 google: 24 android: 24 gms: 24 gcm: 24 java: 21 io: 1 lang: 12 util: 8 concurrent: 5 atomic: 2 overall method count: 72 --- ads: read in 3878 method ids. <root>: 3878 android: 471 app: 50 content: 75 pm: 5 res: 7 database: 13 sqlite: 7 graphics: 12 drawable: 1 location: 4 media: 5 net: 25 os: 67 provider: 1 telephony: 3 text: 2 util: 16 view: 67 webkit: 64 widget: 67 com: 3059 google: 3059 ads: 127 mediation: 96 admob: 23 customevent: 41 android: 2932 gms: 2932 ads: 353 doubleclick: 84 mediation: 75 admob: 2 customevent: 48 purchase: 16 search: 81 analytics: 2 common: 39 internal: 37 safeparcel: 27 dynamic: 5 internal: 2533 java: 318 io: 16 lang: 126 ref: 2 reflect: 3 math: 7 net: 23 security: 11 spec: 1 text: 2 util: 133 concurrent: 28 atomic: 7 org: 30 json: 30 overall method count: 3878 --- identity read in 179 method ids. <root>: 179 android: 34 accounts: 1 app: 2 content: 5 os: 23 text: 1 util: 2 com: 135 google: 135 android: 135 gms: 135 common: 28 api: 4 internal: 21 safeparcel: 15 identity: 75 intents: 75 model: 41 internal: 32 java: 10 lang: 6 util: 4 overall method count: 179 total: 9275
tl;dr the total method counts components use in fact 9275, less half of ends in .apk produced gradle build beginning of question!
trying build .apk without multi-dex support fails, again overstepping 64k method limit.
i have no idea what's going on here, , appreciate help. multi-dex nice , all, 8k methods quite large buffer project alone, , if granular dependencies worked expected, wouldn't have introduce multi-dex long time come.
also, please don't suggest proguard solution. it's band-aid @ best, , not necessary debug builds if dependencies handled correctly.
all dependencies
from app itself:
dependencies { compile 'com.android.support:multidex:1.0.0' compile project(':external_libs:gujemssdk-android:gujemssdk-android-library') compile project(':external_libs:facebook-android-sdk:facebook') compile 'com.android.support:support-v4:22.0.0' compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.google.android.gms:play-services-location:7.0.0' compile 'com.google.android.gms:play-services-ads:7.0.0' compile 'com.google.android.gms:play-services-identity:7.0.0' compile 'com.google.android.gms:play-services-gcm:7.0.0' compile 'com.viewpagerindicator:library:2.4.1@aar' compile 'uk.co.chrisjenx:calligraphy:1.1.0' compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.j256.ormlite:ormlite-core:4.48' compile 'com.j256.ormlite:ormlite-android:4.48' compile 'com.github.bumptech.glide:glide:3.5.2' androidtestcompile 'com.jayway.android.robotium:robotium-solo:5.2.1' }
here's list of jars it's worth:
adjust-android-4.0.2.jar amazon-in-app-purchasing-1.0.3.jar android-support-v7-recyclerview.jar distimosdk.jar eventbus-2.2.1.jar flurryanalytics_3.3.2.jar httpmime-4.1.2.jar mobileapptracker-3.0.jar plasma-1.95.0.jar skmaps.jar socialauth-4.3.jar socialauth-android-3.0.jar
and here dependencies build.gradle scripts of 2 included library projects:
compile files('libs/videoadsdk.jar') compile files('libs/openudidandroid.jar') compile 'com.google.android.gms:play-services-location:7.0.0' compile 'com.google.android.gms:play-services-ads:7.0.0' compile 'com.google.android.gms:play-services-identity:7.0.0'
and
dependencies { compile 'com.android.support:support-v4:22.0.0' }
where second 1 facebook, , has bolts.jar in libs directory.
hope helps!
Comments
Post a Comment