Reputation: 187
I have got an error when I tried to run project in Studio 2.3
FAILURE: Build failed with an exception.
Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex 'C:\Users\xxxxx.android\build-cache\398355577ef004d4acd9193504f7c3a1515a7b74\output\jars\classes.jar' to 'C:\Users\xxxxx\Desktop\yyyyyy\build\intermediates\transforms\dex\debug\folders\1000\10\classes_e69b3e5768928e64d7b1ee699d266a32be93412d'
I have tried below steps but still the same 1) Clean and Rebuild 2) Restart Android studio by selecting "Invalidate caches and restart" 3) Also restart laptop
Here is my app module build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.1'
dexOptions {
preDexLibraries false
javaMaxHeapSize "2g" // Use gig increments depending on needs
incremental true
}
defaultConfig {
applicationId "com.test.example"
minSdkVersion 14
targetSdkVersion 24
multiDexEnabled true
testInstrumentationRunner
'android.support.test.runner.AndroidJUnitRunner'
}
lintOptions {
disable 'NamespaceTypo'
enable 'MissingTranslation'
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.txt'
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
}
packagingOptions {
exclude 'META-INF/BCKEY.DSA'
exclude 'META-INF/BCKEY.SF'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:preference-v7:24.1.1'
compile 'com.android.support:preference-v14:24.1.1'
compile 'com.google.http-client:google-http-client-android:1.20.0'
compile 'com.google.api-client:google-api-client-android:1.20.0'
compile 'com.google.api-client:google-api-client-gson:1.22.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.makeramen:roundedimageview:2.2.0'
compile 'me.leolin:ShortcutBadger:1.1.4@aar'
compile 'org.whispersystems:axolotl-android:1.3.4'
compile 'org.bouncycastle:bcprov-jdk15on:1.52'
compile 'org.bouncycastle:bcmail-jdk15on:1.52'
compile 'org.jitsi:org.otr4j:0.22'
compile 'org.sufficientlysecure:openpgp-api:10.0'
compile 'com.soundcloud.android:android-crop:1.0.1@aar'
compile 'org.gnu.inet:libidn:1.15'
compile 'com.google.zxing:core:3.2.1'
compile 'com.google.zxing:android-integration:3.2.1'
compile 'de.measite.minidns:minidns:0.1.7'
compile 'de.timroes.android:EnhancedListView:0.3.4'
compile ('com.google.android.gms:play-services-gcm:9.0.1')
compile ('com.android.support:support-v13:23.2.1')
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
And Here below is my main build.gradle file
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.gms:google-services:3.0.0'
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
}
Upvotes: 2
Views: 7751
Reputation: 1049
i already solved it it happen because you didnt setting the default java in android studio 2.3.3 or android studio 3.0 beta 6
Upvotes: 0
Reputation: 187
I have resolved that problem. Due to memory size issue I was getting that error and Increasing ram had resolved my issue
Upvotes: 1