title: How to import tensorflow lite in libgdx?
body: <p>I want to use tensorflow lite in libgdx. I'm just using the android subclass, but in my Game.java, I cannot import tensorflow lite. If I try to import it, using import org.tensorflow.lite., I can only see the branch <code>.schema and .support.</code> <a href="https://i.stack.imgur.com/kwwLi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kwwLi.png" alt="enter image description here" /></a></p>
  <p>But I need import org.tensorflow.lite.Interpreter for importing my trained .tflite file.
  I don't know why it isn't working, so can please somebody help, who knows what I'm doing wrong?</p>
  <blockquote>
  <p><strong>build.gradle(PDetection)</strong></p>
  </blockquote>
  <pre><code>buildscript {
  
  
      repositories {
          mavenLocal()
          mavenCentral()
          gradlePluginPortal()
          maven { url &quot;https://oss.sonatype.org/content/repositories/snapshots/&quot; }
          google()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:3.5.4'
  
  
      }
  }
  
  allprojects {
      apply plugin: &quot;eclipse&quot;
  
      version = '1.0'
      ext {
          appName = &quot;PDetection&quot;
          gdxVersion = '1.10.0'
          roboVMVersion = '2.3.12'
          box2DLightsVersion = '1.5'
          ashleyVersion = '1.7.3'
          aiVersion = '1.8.2'
          gdxControllersVersion = '2.1.0'
      }
  
      repositories {
          mavenLocal()
          mavenCentral()
          google()
          gradlePluginPortal()
          maven { url &quot;https://oss.sonatype.org/content/repositories/snapshots/&quot; }
          maven { url &quot;https://oss.sonatype.org/content/repositories/releases/&quot; }
      }
  }
  
  project(&quot;:android&quot;) {
      apply plugin: &quot;com.android.application&quot;
  
      configurations { natives }
  
      dependencies {
          implementation project(&quot;:core&quot;)
          api &quot;com.badlogicgames.gdx:gdx-backend-android:$gdxVersion&quot;
          natives &quot;com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a&quot;
          natives &quot;com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a&quot;
          natives &quot;com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86&quot;
          natives &quot;com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64&quot;
          api &quot;com.badlogicgames.gdx:gdx-box2d:$gdxVersion&quot;
          natives &quot;com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a&quot;
          natives &quot;com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a&quot;
          natives &quot;com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86&quot;
          natives &quot;com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64&quot;
      }
  }
  
  project(&quot;:core&quot;) {
      apply plugin: &quot;java-library&quot;
  
      dependencies {
          api &quot;com.badlogicgames.gdx:gdx:$gdxVersion&quot;
          api &quot;com.badlogicgames.gdx:gdx-box2d:$gdxVersion&quot;
          implementation 'org.tensorflow:tensorflow-lite-support:0.1.0-rc1'
          implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0-rc1'
          implementation 'org.tensorflow:tensorflow-lite-task-vision:0.1.0'
          implementation 'org.tensorflow:tensorflow-lite-task-text:0.1.0'
          implementation 'org.tensorflow:tensorflow-lite:+'
      }
  }
  
  </code></pre>
  <blockquote>
  <p><strong>build.gradle(:android)</strong></p>
  </blockquote>
  <pre><code>android {
      buildToolsVersion &quot;29.0.3&quot;
      compileSdkVersion 29
      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'
      }
  
      aaptOptions {
          noCompress &quot;tflite&quot;
          noCompress &quot;lite&quot;
      }
  
      defaultConfig {
          applicationId &quot;iolgithub.toberocat&quot;
          minSdkVersion 19
          targetSdkVersion 29
          versionCode 1
          versionName &quot;1.0&quot;
          ndk {
              abiFilters 'armeabi-v7a', 'arm64-v8a'
          }
      }
      buildTypes {
          release {
              minifyEnabled true
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  
  // 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 {
      doFirst {
          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.copy().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;
                  }
              }
          }
      }
  }
  
  tasks.whenTaskAdded { packageTask -&gt;
      if (packageTask.name.contains(&quot;package&quot;)) {
          packageTask.dependsOn 'copyAndroidNatives'
      }
  }
  
  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', 'iolgithub.toberocat/iolgithub.toberocat.AndroidLauncher'
  }
  
  eclipse.project.name = appName + &quot;-android&quot;
  
  </code></pre>