1

I'm currently using Android Studio 3.2.1 and came across an issue I couldn't figure out. I've downloaded an mxparser.jar file from mathparser.org to help me with proper equation output.

Click on the link, download the first option. I extracted the MathParser.org-mXparser-v.4.2.0/bin-only/jdk 1.10/MathParser.org-mXparser-v.4.2.0-jdk.1.10.jar file, renamed it to mxparser.jar and copied to the app\libs folder in the project.

This is a brand new project, so everything else is as is. Here is the code in my app file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.imad.equationtyper"
        minSdkVersion 23
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation files('libs/mxparser.jar')
}

The project builds just fine, but crashes when I try to execute it and yields this error:

Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process (path to file)\app\libs\mxparser.jar

Does anyone know how I can solve this?

Imad
  • 11
  • 2
  • In gradle.properties add android.enableD8=true – VVB Dec 10 '18 at 13:53
  • https://stackoverflow.com/questions/47137483/android-studio-3-0-dexarchivebuilderexception – VVB Dec 10 '18 at 13:54
  • I tried it and I'm still getting the same error – Imad Dec 10 '18 at 18:28
  • Keep lib name same & then try – VVB Dec 11 '18 at 06:01
  • Sorry, but I'm still getting the same error – Imad Dec 13 '18 at 05:11
  • I think I've found the issue. I tried this on Eclipse and it worked - I do have Java SE 11 installed, but for some reason, Eclipse didn't use 11 by default - it was using JDK 1.8 and so is Android Studio. I'll have to figure out a way to change what it uses, but I believe this is what's causing it – Imad Dec 14 '18 at 06:13

1 Answers1

0

I found the solution! So the .zip folder I downloaded off mathparser.org had a whole bunch of .jar files. My suspicion of the .jar file not being compiled with the same JDK version was correct. That said, I used one of the older .jar files and it worked perfectly. Thanks for trying to help!

Imad
  • 11
  • 2