8

Have an Android project working in Eclipse (4.4.2) ADT, running on Linux (Ubuntu 14.10).

I have imported to Android Studio (1.1.0) and managed to get rid of my initial compilation errors.

The next thing I want to d is to run on my phone - I push the green "Run" button and after a little while I get an error (this doesn't show up when I just build module, only when I try to run)

The error is this:

Error:Execution failed for task ':myapp:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2

Been looking through SO for the last 4 hours and not found anything that seems relevant to my project. Is there another place I can look to find a more useful error?

EDIT: Aaarghh - just recreated the entire project(rather than trusting the import wizard) - I created a new Android Studio project, imported my code and resources and then solved all the compilation and dependency errors. Got through to a clear build then tried to run....same damn error! Exactly the same. What am I doing wrong????

New build.gradle posted for reference:

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 21
buildToolsVersion "21.1.1"

defaultConfig {
    applicationId "com.mycompany.app_Name"
    minSdkVersion 15
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

repositories { mavenCentral()
    maven { url 'https://maven.fabric.io/public' } }

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile project(':swipeListView')
compile 'com.sothree.slidinguppanel:library:3.0.0'
compile files('libs/volley.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/commons-codec-1.8.jar')
compile files('libs/linkedin-j-android.jar')
compile files('libs/signpost-commonshttp4-1.2.1.1.jar')
compile files('libs/signpost-core-1.2.1.1.jar')
compile files('libs/twitter4j-core-4.0.1.jar')
compile files('libs/core.jar')
compile files('libs/gcm.jar')
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.facebook.android:facebook-android-sdk:3.20.0'
compile('com.crashlytics.sdk.android:crashlytics:2.2.2@aar') {
    transitive = true;
}
compile project(':myImportedProject')
}

Also tried to export as an APK with my keystore: got a similar error:

Error:Execution failed for task ':app:dexRelease'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Kibi
  • 1,860
  • 1
  • 29
  • 39

2 Answers2

1

Sometimes, you would have to remove android libraries which you have in libs folder while you were working in EclipseADT. I recommend to remove android-support-v*.jar from the libs folder after importing it to the Android Studio Directory.

zIronManBox
  • 4,967
  • 6
  • 19
  • 35
0

Aha!

Seems the answer was further up in trace: The error was

com.android.dex.DexException: Multiple dex files define Lcom/nineoldandroids/animation/Animator$AnimatorListener;

So I found the answer here:

ListViewAnimations Library Causes TOP-LEVEL-EXCEPTION

Part of the trick is not only to add the line to build.gradle saying

compile files('libs/nineoldandroids-2.4.0.jar')

but also to remove the JAR from the libs directory.

Now I have more linking issues but I'll leave them for another question I guess.

Community
  • 1
  • 1
Kibi
  • 1,860
  • 1
  • 29
  • 39
  • which build.gradle do you add this to? the lib or the app? i tried to add either one and both, still didnt help me. have the same problem @Kibi – Celly Mar 18 '15 at 10:27
  • In my particular case I added it to the build-gradle of the lib. Basically I had (in Eclipse) an imported project for a "SwipeListView" which had the nineoldandroids jar in its libs directory. Of course it's specific to my case since that was my error. I think my major "insight" here (which isn't too bright) is that the real error was a little further up in the trace. The message "Execution failed for task app:dexDebug" is about as useful as "something bad happened" and should really say "look up higher for the real error." – Kibi Mar 19 '15 at 08:54