mikepenz/Android-Iconics

Application does not contain `com.mikepenz.iconics.Iconics$IconicsBuilder` as referenced in main-dex-list

ivanovpv opened this issue · 10 comments

About this issue

  • library version "com.mikepenz:iconics-core:3.2.5" and "com.mikepenz:iconics-views:3.2.5"
  • gradle build tools: "com.android.tools.build:gradle:3.6.3"
  • support version: "androidx.appcompat:appcompat:1.1.0"
  • Android Studio 3.6.3
  • Android SDK 10
  • multidex enabled in accordance with manual

Large enough application, which uses Androic Iconics

Actually error happens during launching of application can't inflate layout XML, with IconicsButton, which is basically smth like:

  <RelativeLayout
            android:id="@+id/loginLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <com.mikepenz.iconics.view.IconicsButton   <! line #100 -->
                android:id="@+id/loginButton"
                style="@style/NarrowDialogStyle.Button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:layout_alignParentTop="true"
                android:minWidth="0dp"
                android:text="{gmi_long_arrow_right}"
                android:textSize="@dimen/increased_text_size"
                android:textStyle="bold" />

Throwing exception:

android.view.InflateException: Binary XML file line #100: Binary XML file line #100: Error inflating class

Which has origin as of:

java.lang.ClassNotFoundException: Didn't find class "com.mikepenz.iconics.Iconics$IconicsBuilder" on path: DexPathList[....

Also I have noticed that during build there's warning:

Task :app:mergeDexRelease
AGPBI: {"kind":"warning","text":"Application does not contain com.mikepenz.iconics.Iconics$IconicsBuilder as referenced in main-dex-list.","sources":[{}],"tool":"D8"}

Have tried all possible ways to overcome bug: cache clean, restart, rebuild, playing with

 multiDexKeepFile file('multidex-config.txt')
 multiDexKeepProguard file('multidex-config.pro')

Useless. Desperately looking for help

P.S. Can't use latest versions since too many code need to rewritten and can't also use previous support versions (not androidx)

Is this happening in a dev or in a release build?

And multidex setup is properly set-up? it really seems like a multidex issue to me

zTrap commented

@ivanovpv Can you post all of your dependencies?

  1. It happens with both release and debug versions
  2. mutidex setup is correct, since with version 2.* it was working correctly (last workable version was 2.7.0@aar)
  3. full dependencies are as following:
dependencies {
    implementation project(":photoview")
    implementation project(":aFileChooser")
    implementation project(":kprogresshud")
    implementation project(":keepassandroid2")
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0"
    implementation "androidx.documentfile:documentfile:1.0.1"
    implementation "androidx.multidex:multidex:2.0.1"
    implementation "androidx.preference:preference:1.1.1"
    implementation "androidx.exifinterface:exifinterface:1.2.0"
    implementation "androidx.legacy:legacy-preference-v14:1.0.0"

    implementation "com.google.code.gson:gson:2.8.5" //gson
    implementation("ch.acra:acra-core:5.5.0") { //acra
        exclude group: "org.json" //to avoid clash conflict with Gradle
    }
    implementation "ch.acra:acra-mail:5.5.0" //acra mail sender
    implementation "ch.acra:acra-dialog:5.5.0" //acra mail sender
    implementation "com.j256.ormlite:ormlite-android:5.0" //ormlite
    //iconics
    implementation "com.mikepenz:iconics-core:3.2.5"
    implementation "com.mikepenz:iconics-views:3.2.5"
    //implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.2'
    implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.5@aar'

    implementation "com.jakewharton:butterknife:10.2.1"
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
    implementation "com.nostra13.universalimageloader:universal-image-loader:1.9.5"
    //universal image loader
    implementation 'com.intuit.sdp:sdp-android:1.0.3'//sdp (scalable DP)
    testImplementation 'junit:junit:4.12'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.7' //rxJava2
    implementation 'com.mtramin:rxfingerprint:2.2.1' //rxFingerprint
    implementation 'com.mattprecious.swirl:swirl:1.0.0' //fingerprint swirl control
    implementation 'com.wefika:flowlayout:0.4.1' //flowlayout
    implementation 'commons-codec:commons-codec:1.11'
    implementation 'org.slf4j:slf4j-android:1.7.25' //slf4j for Android
    implementation 'de.rtner:PBKDF2:1.1.2' //pbkdf2 for Java
}

zTrap commented

Probably its gradle problem with resolving dependencies. Can you run dependencies gradle command and post log?

Here's a link to dependencies

zTrap commented

Here is failed build

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':aFileChooser:compileDebugJavaWithJavac'.
Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_251 contains a valid JDK installation.

Can you update your JAVA_HOME system variable and rerun this task?

Sure, I've fixed JAVA_HOME, here's new build scan

zTrap commented

You have core and views libraries in 2 modules:

  1. aFileChooser -> version 4.0.2 (kotlin version where class Iconics.IconicsBuilder was removed)
  2. app -> version 3.2.5

Gradle uses in compile process version 4.0.2 for app module which uncompatible with 3.2.5

Solution: change version in module aFileChooser to 3.2.5

Thanks @zTrap .


@ivanovpv please ensure you retain the same version of dependencies :)
Mixing major release versions with each other will cause problems with most libraries. even mixing minor versions may result in bytecode level problems.


For this

./gradlew module:dependencies

is also a super great tool to investigate :)

Thanks, I do confirm fix of problem :)

Continuing to use this greatest Iconics!