Exportación de Android Studio Project a GIT

Recientemente comencé a probar Android Studio y decidí que quería crear una aplicación. La aplicación está en path, pero no quiero ponerla en un repository git donde los compañeros de trabajo pueden queueborar.

Intenté simplemente copyr el proyecto en un repository git y usar este file .gitignore que encontré en otro hilo.

*.iml *.iws *.ipr .idea/ .gradle/ local.properties */build/ *~ *.swp 

Llegué al repository, pero cuando traté de importarlo en Android Studio en otra PC, el proyecto no se veía igual y daba un error sobre las classs dobles. No sé si el problema es cómo lo puse en mi repository de git o sobre cómo importarlo en una nueva PC.

¿Hay consideraciones especiales sobre poner un proyecto de estudio de Android en GIT o algo que debe hacerse al importar un proyecto ?, ¿Qué hice mal?

EDITAR

./gradlew clean && ./gradlew build como se sugiere. Aquí está el resultado:

 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:491) 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:491) 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:491) 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:491) 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 

ejecutar ./gradlew --debug probablemente le dará más información sobre lo que está sucediendo. Tuve el mismo error y al agregar el indicador de debugging me dijo que SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable. SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

Después de agregar la variable de entorno ANDROID_HOME, gradle construyó el proyecto con éxito.