I am trying to add the MPAndroidChartLibrary to my Android Studio project, however when I try to run the app, it keeps failing with 1 error. I am not very good with gradle, so I don't really know whats going wrong.
My gradle file is this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.0.2"
defaultConfig {
applicationId "com.bacon.corey.audiotimeshift"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:support-v4:21.0.0'
compile files('C:/Users/Corey/.AndroidStudioBeta/Projects/AudioTimeShift/libraries/mpandroidchartlibrary-1-7-4.jar')
}
As far as I can see, this should all be fine, however it is not working. This is the log from the Gradle console:
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72100Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42100Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava
Note: C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\src\main\java\com\bacon\corey\audiotimeshift\MainActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:preDexDebug
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Program Files (x86)\Android\android-sdk\build-tools\21.0.2\dx.bat --dex --output C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\dex\debug C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\classes\debug C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\dependency-cache\debug C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\pre-dexed\debug\classes-08104da82547c1da8de562eb9350a514962ceaa7.jar C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\pre-dexed\debug\classes-c916341f097aba848a3f8d1cb524d87b40a5e434.jar C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\pre-dexed\debug\internal_impl-21.0.0-dd323fb38f6f05cc36bfccaf6824e44b4d16534e.jar C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\pre-dexed\debug\library-2.4.0-1028d824e09b12c83da4be3e497c82fdc33874f5.jar C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\pre-dexed\debug\mpandroidchartlibrary-1-7-4-1e0626ccaecee3e156334e8c3c9fcf07d352edb9.jar C:\Users\Corey\.AndroidStudioBeta\Projects\AudioTimeShift\app\build\intermediates\pre-dexed\debug\support-annotations-21.0.0-9528452d0a4563476596d64e06f21a3014c413f7.jar
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/nineoldandroids/animation/ValueAnimator$AnimatorUpdateListener;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
Information:BUILD FAILED
Information:Total time: 18.241 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
If someone could please give me a few pointers as to where I am going wrong, I would be immensively grateful.
Thanks, Corey B :)
MPAndroidChart already has com.nineoldandroids:library:2.4.+
as a dependency. Remove compile 'com.nineoldandroids:library:2.4.0'
from your dependencies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With