title: Tried to Add Library, but with Gradlew Clean: Build Fails in Android Studio
body: <p>I'm new to Android Studio and intelliJ. I'm trying to add a library. I put the .jar in the libs folder, and added</p>
  
  <pre><code>compile files('libs/achartengine-1.0.0.jar', 'libs/jsoup-1.7.2.jar')
  </code></pre>
  
  <p>to build.gradle. And I tried navigating in terminal to my project folder and running
      gradlew clean
  but I got:</p>
  
  <pre><code>Starting Build
  Settings evaluated using empty settings script.
  Projects loaded. Root project using build file '/Users/myname/Documents/workspace/myproject/build.gradle'.
  Included projects: [root project 'myproject']
  Evaluating root project 'myproject' using build file '/Users/myname/Documents/workspace/myproject/build.gradle'.
  Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence.
  org.gradle.listener.ListenerNotificationException: Failed to notify project evaluation listener.
  at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:90)
  at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
  at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
  at com.sun.proxy.$Proxy11.afterEvaluate(Unknown Source)
  at org.gradle.configuration.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
  at org.gradle.configuration.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
  at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:465)
  at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:76)
  at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
  at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
  at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
  at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
  at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
  at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
  at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
  at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
  at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
  at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
  at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
  at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
  at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
  at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
  at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
  at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
  at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
  at org.gradle.launcher.Main.doAction(Main.java:48)
  at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
  at org.gradle.launcher.Main.main(Main.java:39)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
  at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
  at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
  at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
  at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
  Caused by: java.lang.NullPointerException
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.createGroovyObjectGetPropertySite(AbstractCallSite.java:254)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.acceptGroovyObjectGetProperty(AbstractCallSite.java:239)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
  at com.android.build.gradle.BasePlugin.resolveDependencyForConfig(BasePlugin.groovy:1211)
  at com.android.build.gradle.BasePlugin$resolveDependencyForConfig.callCurrent(Unknown Source)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:153)
  at com.android.build.gradle.BasePlugin.resolveDependencies(BasePlugin.groovy:1164)
  at com.android.build.gradle.BasePlugin$resolveDependencies.callCurrent(Unknown Source)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
  at com.android.build.gradle.AppPlugin.doCreateAndroidTasks(AppPlugin.groovy:196)
  at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.groovy:242)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
  at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
  at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:361)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
  at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
  at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
  at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:137)
  at com.android.build.gradle.BasePlugin$_apply_closure1.doCall(BasePlugin.groovy:190)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
  at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
  at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
  at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:877)
  at groovy.lang.Closure.call(Closure.java:412)
  at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
  at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
  at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:81)
  ... 41 more
  
  FAILURE: Build failed with an exception.
  
  * Where:
  Build file '/Users/myname/Documents/workspace/myproject/build.gradle' line: 10
  
  * What went wrong:
  A problem occurred evaluating root project 'myproject'.
  &gt; SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
  
  BUILD FAILED
  </code></pre>
  
  <p>But I thought I set the paths correctly; the project runs find until I try to use the added library (the app crashes, of course). Here's the relevant part of my .profile</p>
  
  <pre><code>export ANDROID_SDK="&lt;Downloads/android-sdk-macosx/platform-tools&gt;"
  export ANDROID_NDK="&lt;Downloads/android-ndk-r8b&gt;"
  export ANDROID_HOME="&lt;Downloads/android-sdk-macosx&gt;"
  export PATH="$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK"
  </code></pre>
  
  <p>Any help would be appreciated.</p>
  
  <p>Edit: changed path as suggested in answer below. Problem persists. More error info added as requested. </p>