I'm integrating my app into Android AOSP source code to compile. I encountered an issue said as below:
ERROR: Dex writing phase: classes.dex has too many IDs. Try using multi-dex
It worked fine in android studio. My app setting looks like:
public class App extends MultiDexApplication{
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Setting in mainifest.xml
android:name=".App"
dependencies{
compile 'com.android.support:multidex:1.0.1'
}
defaultConfig {
multiDexEnabled true
}
I found a solution at here: How to enable mulit dex ,when building apk in AOSP?
but it didn't work.
My mk file looks like:
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DX_FLAGS := --multi-dex --main-dex-list=$(mainDexList) --minimal-main-dex
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := multidex-1.0.1:libs/multidex-1.0.1.aar
Any help? Thanks in advance.
Added below two lines into your mk files. It should work.
LOCAL_DX_FLAGS := --multi-dex --main-dex-list=$(mainDexList) --minimal-main-dex
LOCAL_JACK_FLAGS += --multi-dex native