0

I'm attempting to upgrade my app. When I add AppCompat-v7 to my gradle, I couldn't build my app

My Gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.pvi.claimonline"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 15
        versionName "1.9.5"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
}

and Error received

Error:Execution failed for task ':ClaimOnline:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_111\bin\java.exe'' finished with non-zero exit value 2

Any idea?

Brijesh Kumar
  • 1,685
  • 2
  • 17
  • 28
Tuyenp
  • 81
  • 1
  • 11
  • The `com.android.support:design:23.3.0` lib already has a dependency to appcompat-v7. So you don't need to add appcompat-v7. Invalidate android studio cache (`File -> Invalidate Caches/Restart`) and try to sync gradle. – Fabricio Oct 21 '16 at 10:10

1 Answers1

0

Use MultiDex if you have more than 64K method.

Add multidex dependency in build.gradle.

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

inside defalutConfig add

  multiDexEnabled true

Make changes to manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.multidex.myapplication">
<application
      ...
      android:name="android.support.multidex.MultiDexApplication">
       ...
</application>
Sanjeet
  • 2,385
  • 1
  • 13
  • 22