0

N.B. This Question Is not a match as I cant find any working solution.

I have used almost every process to solve this but still facing same.

First: multiDexEnabled true

Second: compile 'com.android.support:multidex:1.0.1'

Third: org.gradle.jvmargs=-XX\:MaxHeapSize\=512m -Xmx512m (in Local.properties)

Fourth: android:name="android.support.multidex.MultiDexApplication" (In manifest.xml)

Fifth: Clean & Rebuild

Sixth: File < Invalidate cache & Restart

If anyone is looking for solution, These may work for you. But for me none are working.

What should I do ? (I'm working on Digital wallet project).

Errors: 1:

Error:Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Exception parsing classes

Error 2: Error:1 error; aborting

Error 3:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process

build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.example.intuition.paytmprogress"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
//        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:multidex:1.0.1'

//    PayTm
    compile files('libs/PGSDK_V2.0.jar')
    compile files('libs/paytm-checksum_2.0.jar')
    compile files('libs/jackson-databind-2.9.1.jar')

    //Freecharge
//    compile 'com.android.support:support-v4:+'
//    compile 'in.freecharge.checkout.android:freecharge-checkout-android-sdk:2.2@aar'
//    compile 'in.juspay:godel:0.6.12.1423'
}
GoGoaGone
  • 11
  • 3

2 Answers2

0

For your Application Multidex not required.

Don't use + operator in dependency version.

Try this new Config:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.example.intuition.paytmprogress"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
}

Remove the multiDex application from the manifest.

2) I can see some of the commented dependencies.

if you use those dependencies follow these instructions.

  • Remove compile 'com.android.support:support-v4:+' from it. Because support-v7 library includes v4 support library.

  • Ensure your libraries using the same version of your support library. if you got a red line under your support library saying found multiple version of support library. you have to downgrade your support library version to match that.

  • Add multidex only it exceeds single Dex.

Clean and Rebuild your project.

Bhuvanesh BS
  • 13,474
  • 12
  • 40
  • 66
  • If I add external Jar files I can see same issues again. :( – GoGoaGone Sep 15 '17 at 07:06
  • Still getting Errors.........Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4-output C:\AndroidStudioProjects\app\build\intermediates\pre-dexed\debug\paytm-checksum_2.0_0927f64182307d227e049.jar C:\AndroidStudioProjects\app\libs\paytm-checksum_2.0.jar} – GoGoaGone Sep 19 '17 at 05:19
0

You need to use same the version for compileSdkVersion, buildToolsVersion, and the support library. Hence, you need to use version 26. So, you need to change it something like the following:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26 // need version 26
    buildToolsVersion "26.0.3" // need version 26
    defaultConfig {
        applicationId "com.example.intuition.paytmprogress"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    ...
}

dependencies {
    ...
    // Need version 26.
    compile 'com.android.support:appcompat-v7:26.1.0'  
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

Don't use multidex because you don't need it yet.

-- UPDATED--

FOr support version 26.1.0, you need to add the google maven to your root build.gradle like this:

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}

Read more at Failed to resolve: com.android.support:appcompat-v7:26.0.0

ישו אוהב אותך
  • 28,609
  • 11
  • 78
  • 96
  • compile 'com.android.support:appcompat-v7:26.0.3' <--I'm getting Error This package is not available to download. – GoGoaGone Sep 18 '17 at 13:25
  • Error:Error converting bytecode to dex: Cause: PARSE ERROR: class name (com/paytm/pg/AppTest) does not match path (target/test-classes/com/paytm/pg/AppTest.class) ...while parsing target/test-classes/com/paytm/pg/AppTest.class -----------------------------------------------------This is the error I am getting still. – GoGoaGone Sep 19 '17 at 05:09
  • That's is a different kind of error. You need to check `com/paytm/pg/AppTest` for the class. – ישו אוהב אותך Sep 19 '17 at 05:12