Hi,
When i am trying to build companion for app-inventor sources i am getting this error:-
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Too many classes in --main-dex-list, main dex capacity exceeded
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:494)
at com.android.dx.command.dexer.Main.runMultiDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:244)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
Any reason and solution for this error?
Any help will be appreciated,
Akshat
Anyone? Does this error means that i used a lot of libraries?
Most likely. There is a list of libraries that are used to create the main dex class list. These are included along with the component classes in AndroidRuntime.jar. You'll need to adjust the list of critical JAR files to reduce the size of the main dex size.
I have changed nothing in this list so i think these are the minimum required libraries
private static final Set<String> CRITICAL_JARS =
new HashSet<>(Arrays.asList(
// Minimum required for Android 4.x
RUNTIME_FILES_DIR + "appcompat.jar",
RUNTIME_FILES_DIR + "collection.jar",
RUNTIME_FILES_DIR + "core.jar",
RUNTIME_FILES_DIR + "core-common.jar",
RUNTIME_FILES_DIR + "lifecycle-common.jar",
RUNTIME_FILES_DIR + "vectordrawable.jar",
RUNTIME_FILES_DIR + "vectordrawable-animated.jar",
// Extras that may be pulled
RUNTIME_FILES_DIR + "annotation.jar",
RUNTIME_FILES_DIR + "asynclayoutinflater.jar",
RUNTIME_FILES_DIR + "coordinatorlayout.jar",
RUNTIME_FILES_DIR + "core-runtime.jar",
RUNTIME_FILES_DIR + "cursoradapter.jar",
RUNTIME_FILES_DIR + "customview.jar",
RUNTIME_FILES_DIR + "documentfile.jar",
RUNTIME_FILES_DIR + "drawerlayout.jar",
RUNTIME_FILES_DIR + "fragment.jar",
RUNTIME_FILES_DIR + "interpolator.jar",
RUNTIME_FILES_DIR + "legacy-support-core-ui.jar",
RUNTIME_FILES_DIR + "legacy-support-core-utils.jar",
RUNTIME_FILES_DIR + "lifecycle-livedata.jar",
RUNTIME_FILES_DIR + "lifecycle-livedata-core.jar",
RUNTIME_FILES_DIR + "lifecycle-runtime.jar",
RUNTIME_FILES_DIR + "lifecycle-viewmodel.jar",
RUNTIME_FILES_DIR + "loader.jar",
RUNTIME_FILES_DIR + "localbroadcastmanager.jar",
RUNTIME_FILES_DIR + "print.jar",
RUNTIME_FILES_DIR + "slidingpanelayout.jar",
RUNTIME_FILES_DIR + "swiperefreshlayout.jar",
RUNTIME_FILES_DIR + "versionedparcelable.jar",
RUNTIME_FILES_DIR + "viewpager.jar"
));
But still companion gives error
PS: I compared it with the default CriticalJars but there is no difference so maybe the problem lies in other file or maybe because use to many libraries