Last active
August 29, 2015 14:08
-
-
Save Jakevin/ea123aa0ce7281c52b0e to your computer and use it in GitHub Desktop.
Too many method references: 76184; max is 65536. 解決專案參考方法超過 65536
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
由於新版Google Play Service加入了非常多的無用方法(Games、Book等等),會讓APP在Compiler出現下面錯誤 | |
trouble writing output: Too many method references: 76184; max is 65536. | |
感謝 Fate Chang大師的幫忙提供方向 | |
找到了下面這篇解決方案: | |
Multi-dex to rescue from the infamous 65536 methods limit | |
http://blog.osom.info/2014/10/multi-dex-to-rescue-from-infamous-65536.html | |
並從其討論GitHub解決了我的問題,就順手把解決方案放上來 | |
參考: | |
https://github.com/casidiablo/multidex |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- in application add name parameter --> | |
<application | |
android:name="yourpackagename.AppApplication" | |
android:icon="@drawable/ic_launcher" | |
android:label="@string/app_name"> | |
</application> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
//your setting 你自己的設定 | |
//Add this setting 請加入下面設定 | |
dexOptions { | |
preDexLibraries = false | |
javaMaxHeapSize "2g" | |
} | |
} | |
//Must follow 請依照下面設定 | |
afterEvaluate { | |
tasks.matching { | |
it.name.startsWith('dex') | |
}.each { dx -> | |
if (dx.additionalParameters == null) { | |
dx.additionalParameters = [] | |
} | |
dx.additionalParameters += '--multi-dex' | |
//option 選定 | |
//dx.additionalParameters += "--main-dex-list=$projectDir/multidex.keep".toString() | |
} | |
} | |
dependencies { | |
/** | |
* your setting start | |
**/ | |
//add this | |
compile files('libs/android-support-multidex.jar') | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.support.multidex.MultiDexApplication; | |
//Must extends MultiDexApplication 請繼承 | |
public class AppApplication extends MultiDexApplication { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment