Running apps containing large amount of code

前端 未结 2 1019
青春惊慌失措
青春惊慌失措 2020-12-29 12:43

Background

It seems some old Android OSs (and maybe even the newest ones) have a limitation on the amount of code each app can hold.

As I\'ve found, the li

相关标签:
2条回答
  • 2020-12-29 12:53

    The limit is the total number of method references:

    • https://code.google.com/p/android/issues/detail?id=7147#c6
    • https://code.google.com/p/android/issues/detail?id=20814#c6

    A middle ground between doing nothing and the multi-dex approach described in the FB/Google articles is to use a tool like ProGuard to remove references to unused code at the Java level. See:

    • http://proguard.sourceforge.net/
    • http://developer.android.com/tools/help/proguard.html
    0 讨论(0)
  • 2020-12-29 13:01

    There is a new solution, made by Google:

    • https://plus.google.com/+IanLake/posts/JW9x4pcB1rj?utm_source=Android%20Weekly&utm_campaign=59f1f4bf4d-Android_Weekly_125&utm_medium=email&utm_term=0_4eb677ad19-59f1f4bf4d-337848877
    • http://developer.android.com/reference/android/support/multidex/MultiDexApplication.html

    It seems all you have to do is any of the next things: - extend from "MultiDexApplication" instead of from "Application" - call MultiDex.install(context) in your application's attachBaseContext

    But now I wonder:

    1. Is that really it?
    2. Does it have any issues ? Does it affect performance?
    3. How does it work?
    4. What should be done with ContentProvider, as it's getting called before Application gets initialized?
    5. The post says "gives you MultiDex support on all API 4+ devices (well, until v21, where you get this natively)" . Does it mean that from v21 it will be the default behavior, or just that the class will be built in and you won't need to use the support library's class ?
    6. Will this solution work on Eclipse too?
    0 讨论(0)
提交回复
热议问题