title: Sharing one java library between Android and Java backend (gradle)
body: <p>I have a library that works well within my android app (it is not exported as a jar, and instead is including as part of the android project).
  I am now developing backend, and want to use that particular library for my Java backend.</p>
  
  <p>Both java 1.8.  I use gradle in the Android world, as well as in the Java (PC) world.</p>
  
  <p>For android I am using Android studio (latest). For PC I am using IDEA community edition ( 2017 release).</p>
  
  <p>When including the java library into PC gradle project, gradle (ver 3.3) is complaining about Android related stuff ( eg SDK location is not found, set ANDROID_HOME, etc).</p>
  
  <p>I would like to get the gradle on Java backend app (PC version, as I call it) -- to ignore  android things completely  -- without creating a different copy of the library or another build.gradle for the library...</p>
  
  <p>in other words, the only 2 things that I need from there is </p>
  
  <pre><code>dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
      compile 'com.google.code.gson:gson:2.8.0'
  }
  </code></pre>
  
  <p>Is this possible?</p>
  
  <p>Here is build.gradle for the library that I am trying to share across</p>
  
  <pre><code>buildscript {
      repositories {
          jcenter()
      }
      dependencies {
          classpath "com.android.tools.build:gradle:2.3.0"
          classpath "me.tatarka:gradle-retrolambda:3.6.0"
      }
  }
  
  allprojects {
          repositories {
              jcenter()
          }
  
          logger.quiet('showing env var in mysharedlib root gradle.')
          buildDir = "${System.getenv('HOME')}/tmp/${rootProject.name}/${project.name}"
  }
  
  
  apply plugin: 'com.android.library'
  apply plugin: 'me.tatarka.retrolambda'
  
  android {
      compileSdkVersion 23
      buildToolsVersion "25.0.1"
  
      defaultConfig {
          minSdkVersion 16
          targetSdkVersion 25
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
      androidTestCompile 'junit:junit:4.12'
      compile 'com.google.code.gson:gson:2.8.0'
  }
  </code></pre>