title: Packaging for Android failed due to "source release 1.8 requires target release 1.8"
body: <p>I'm trying to perform packaging for Android based on <a href="https://github.com/libgdx/libgdx/wiki/Gradle-on-the-Commandline#packaging-the-project" rel="nofollow noreferrer">this Gradle on Commandline</a> wiki article, however I'm not successful due to error:</p>
  <blockquote>
  <p>[ERROR] [system.err] javacTask: source release 1.8 requires target release 1.8</p>
  </blockquote>
  <p>I was trying to run the gradle command with <code>--debug</code> param like this:</p>
  <pre><code>gradlew android:assembleDebug --debug
  </code></pre>
  <p>and in logs I can see such lines:</p>
  <blockquote>
  <p>01:51:53.707 [INFO] [org.gradle.api.internal.changedetection.changes.RebuildIncrementalTaskInputs] All input files are considered out-of-date for incremental task ':android:compileDebugJavaWithJavac'.</p>
  <p>01:51:53.707 [INFO] [org.gradle.api.Task] Compiling with source level 1.8 and target level 1.7.</p>
  <p>...</p>
  <p>01:51:53.731 [DEBUG] [org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler] Compiler arguments: -source 1.8 -target 1.7 -d ...</p>
  </blockquote>
  <p>How the heck is he getting this <strong>1.7</strong>? I tried to change source/target versions in <code>core/build.gradle</code> and <code>android/build.gradle</code> to 1.7 (and ofc fix all issues after this change) but unfortunately with no effect</p>
  <p>Did anyone meet this issue? How to handle this?</p>
  <hr />
  <p>I'm using JDK jdk1.8.0_73</p>
  <p>I have SDK path defined inside <code>local.properties</code> file however I have also the <code>ANDROID_HOME</code> system variable (Windows here) set - to the same SDK location</p>
  <p>I'm using the default <code>build.gradle</code> files so for the <code>core/build.gradle</code> I have</p>
  <pre><code>apply plugin: &quot;java&quot;
  
  targetCompatibility = 1.8
  sourceCompatibility = 1.8
  [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
  
  sourceSets.main.java.srcDirs = [ &quot;src/&quot; ]
  
  
  eclipse.project {
      name = appName + &quot;-core&quot;
  }
  </code></pre>
  <p>and for the <code>android/build.gradle</code>:</p>
  <pre><code>android {
      buildToolsVersion &quot;28.0.1&quot;
      compileSdkVersion 28
      sourceSets {
          main {
              manifest.srcFile 'AndroidManifest.xml'
              java.srcDirs = ['src']
              aidl.srcDirs = ['src']
              renderscript.srcDirs = ['src']
              res.srcDirs = ['res']
              assets.srcDirs = ['assets']
              jniLibs.srcDirs = ['libs']
          }
  
      }
      packagingOptions {
          exclude 'META-INF/robovm/ios/robovm.xml'
      }
      defaultConfig {
          applicationId &quot;com.mantkowicz.light.game&quot;
          minSdkVersion 9
          targetSdkVersion 28
          versionCode 1
          versionName &quot;1.0&quot;
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
      }
  }
  // called every time gradle gets executed, takes the native dependencies of
  // the natives configuration, and extracts them to the proper libs/ folders
  // so they get packed with the APK.
  task copyAndroidNatives() {
      file(&quot;libs/armeabi/&quot;).mkdirs();
      file(&quot;libs/armeabi-v7a/&quot;).mkdirs();
      file(&quot;libs/arm64-v8a/&quot;).mkdirs();
      file(&quot;libs/x86_64/&quot;).mkdirs();
      file(&quot;libs/x86/&quot;).mkdirs();
  
      configurations.natives.files.each { jar -&gt;
          def outputDir = null
          if (jar.name.endsWith(&quot;natives-arm64-v8a.jar&quot;)) outputDir = file(&quot;libs/arm64-v8a&quot;)
          if (jar.name.endsWith(&quot;natives-armeabi-v7a.jar&quot;)) outputDir = file(&quot;libs/armeabi-v7a&quot;)
          if (jar.name.endsWith(&quot;natives-armeabi.jar&quot;)) outputDir = file(&quot;libs/armeabi&quot;)
          if (jar.name.endsWith(&quot;natives-x86_64.jar&quot;)) outputDir = file(&quot;libs/x86_64&quot;)
          if (jar.name.endsWith(&quot;natives-x86.jar&quot;)) outputDir = file(&quot;libs/x86&quot;)
          if (outputDir != null) {
              copy {
                  from zipTree(jar)
                  into outputDir
                  include &quot;*.so&quot;
              }
          }
      }
  }
  task run(type: Exec) {
      def path
      def localProperties = project.file(&quot;../local.properties&quot;)
      if (localProperties.exists()) {
          Properties properties = new Properties()
          localProperties.withInputStream { instr -&gt;
              properties.load(instr)
          }
          def sdkDir = properties.getProperty('sdk.dir')
          if (sdkDir) {
              path = sdkDir
          } else {
              path = &quot;$System.env.ANDROID_HOME&quot;
          }
      } else {
          path = &quot;$System.env.ANDROID_HOME&quot;
      }
  
      def adb = path + &quot;/platform-tools/adb&quot;
      commandLine &quot;$adb&quot;, 'shell', 'am', 'start', '-n', 'com.mantkowicz.light.game/com.mantkowicz.light.game.AndroidLauncher'
  }
  // sets up the Android Eclipse project, using the old Ant based build.
  eclipse {
      // need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin
      // ignores any nodes added in classpath.file.withXml
      sourceSets {
          main {
              java.srcDirs &quot;src&quot;, 'gen'
          }
      }
  
      jdt {
          sourceCompatibility = 1.6
          targetCompatibility = 1.6
      }
  
      classpath {
          plusConfigurations += [project.configurations.compile]
          containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'
      }
  
      project {
          name = appName + &quot;-android&quot;
          natures 'com.android.ide.eclipse.adt.AndroidNature'
          buildCommands.clear();
          buildCommand &quot;com.android.ide.eclipse.adt.ResourceManagerBuilder&quot;
          buildCommand &quot;com.android.ide.eclipse.adt.PreCompilerBuilder&quot;
          buildCommand &quot;org.eclipse.jdt.core.javabuilder&quot;
          buildCommand &quot;com.android.ide.eclipse.adt.ApkBuilder&quot;
      }
  }
  // sets up the Android Idea project, using the old Ant based build.
  idea {
      module {
          sourceDirs += file(&quot;src&quot;);
          scopes = [COMPILE: [plus: [project.configurations.compile]]]
  
          iml {
              withXml {
                  def node = it.asNode()
                  def builder = NodeBuilder.newInstance();
                  builder.current = node;
                  builder.component(name: &quot;FacetManager&quot;) {
                      facet(type: &quot;android&quot;, name: &quot;Android&quot;) {
                          configuration {
                              option(name: &quot;UPDATE_PROPERTY_FILES&quot;, value: &quot;true&quot;)
                          }
                      }
                  }
              }
          }
      }
  }
  dependencies {
  }
  </code></pre>