2

Recently I noticed that when I compile my app in release mod, R8 log the following warning message: Missing class: javax.swing.JFrame along with others Swing/Java desktop classes like Missing class: java.awt.event.WindowAdapter or Missing class: java.applet.Applet.

Unless I'm wrong, this have nothing to do in my Android application. How can I find where this come from?

I tried to check my app dependencies using ./gradlew app:dependencies but found nothing relevant since those classes come from the JRE.

My dependencies list as requested:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
    implementation "io.reactivex.rxjava2:rxjava:2.2.19"
    implementation "joda-time:joda-time:2.10.6"
    implementation "org.greenrobot:eventbus:3.2.0"
    debugImplementation "com.squareup.leakcanary:leakcanary-android:2.3"
    implementation("com.crashlytics.sdk.android:crashlytics:2.10.1@aar") {
        transitive = true
    }
    implementation "xom:xom:1.3.5"

    implementation "io.requery:requery-android:1.6.1"
    implementation "io.requery:requery-jackson:1.6.1"
    kapt "io.requery:requery-processor:1.6.1"

    implementation "com.squareup.okhttp3:okhttp:4.7.2"
    implementation "com.squareup.okhttp3:logging-interceptor:4.7.2"
    implementation "com.squareup.retrofit2:retrofit:2.9.0"
    implementation "com.squareup.retrofit2:converter-scalars:2.9.0"
    implementation "com.squareup.retrofit2:converter-jackson:2.9.0"
    implementation "com.fasterxml.jackson.core:jackson-databind:2.11.0"

    implementation "com.google.android.material:material:1.1.0"
    implementation "androidx.appcompat:appcompat:1.1.0"
    implementation "androidx.cardview:cardview:1.0.0"
    implementation "androidx.gridlayout:gridlayout:1.0.0"
    implementation "androidx.constraintlayout:constraintlayout:1.1.3"
    implementation("com.mikepenz:materialdrawer:6.1.2") {
        transitive = true
    }
    implementation "com.balysv.materialmenu:material-menu:2.0.0"
    implementation "com.airbnb.android:lottie:3.4.0"
    implementation "com.github.rey5137:material:1.3.0"
    implementation "com.github.sevar83:indeterminate-checkbox:1.0.5@aar"
    implementation "com.github.woxthebox:draglistview:1.7.1"
    implementation "me.philio:pinentryview:1.0.6"

    testImplementation "org.robolectric:robolectric:4.3.1"
    implementation "org.robolectric:annotations:4.3.1"
    implementation "org.robolectric:shadowapi:4.3.1"
    kaptTest "com.google.auto.service:auto-service:1.0-rc6"
    testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
    testImplementation "androidx.test:runner:1.2.0"
    testImplementation "androidx.test:core:1.2.0"
    testImplementation "org.mockito:mockito-core:3.3.3"
    kaptAndroidTest "org.mockito:mockito-android:3.3.3"
}
Bencri
  • 749
  • 1
  • 4
  • 16
  • 1
    Consider posting your dependencies list in an edit to the question. Perhaps we will see something. – CommonsWare May 25 '20 at 15:43
  • @CommonsWare Done. I know this is a bit out of scope but feel free to tell me if you see anything that bother you other than this, I'm open to criticism. – Bencri May 25 '20 at 15:54
  • 1
    In terms of where the Swing references are coming from, the only one here that scares me is `xom:xom`. That looks like a dependency for ordinary Java, not something Android-specific, so it is a possible source of those references. Also, you still have `implementation fileTree(include: ['*.jar'], dir: 'libs')` -- do you have any JARs in `libs/`? If yes, they might be the source of the problem. If no, you could get rid of that `implementation` line. – CommonsWare May 25 '20 at 16:02
  • Yes I have a jar in `libs`. How can I use `xom` without embedding Swing in my app? I need that lib as the default xml lib of Android is way too limited for what I have to do. – Bencri May 25 '20 at 16:22
  • I don't *know* that `xom` is a problem. But, whereas everything else seems to be fairly Android-specific (and should not have Swing references), `xom` is not. `xom` and your JAR are the two most likely sources of the Swing references. – CommonsWare May 25 '20 at 16:30

0 Answers0