title: Android Mobile Vision API library not found
body: <p>We have developed a library that among other things, uses Android Mobile Vision API in order to detect user's face. The following problem occurs only on <strong>Lenovo Tab E7</strong> and <strong>Billow X703</strong>.</p>
  
  <pre class="lang-java prettyprint-override"><code>    private void createCameraSource() {
  
          Context context = getApplicationContext();
          FaceDetector detector = new FaceDetector.Builder(context)
                  .setProminentFaceOnly(true)
                  .setTrackingEnabled(true)
                  .setClassificationType(com.google.android.gms.vision.face.FaceDetector.ALL_CLASSIFICATIONS)
                  .setMode(com.google.android.gms.vision.face.FaceDetector.ACCURATE_MODE)
                  .setMinFaceSize(minFaceSize)
                  .build();   // &lt;--- HERE IS THE EXCEPTION
  
          detector.setProcessor(
                  new MultiProcessor.Builder&lt;&gt;(new GraphicFaceTrackerFactory())
                          .build());
  
          if (!detector.isOperational()) {
              // Note: The first time that an app using face API is installed on a device, GMS will
              // download a native library to the device in order to do detection.  Usually this
              // completes before the app is run for the first time.  But if that download has not yet
              // completed, then the above call will not detect any faces.
              //
              // isOperational() can be used to check if the required native library is currently
              // available.  The detector will automatically become operational once the library
              // download completes on device.
              Log.w(TAG, "Face detector dependencies are not yet available.");
  
              // Check for low storage.  If there is low storage, the native library will not be
              // downloaded, so detection will not become operational.
              IntentFilter lowstorageFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);
              boolean hasLowStorage = registerReceiver(null, lowstorageFilter) != null;
  
              if (hasLowStorage) {
                  Toast.makeText(this, R.string.low_storage_error, Toast.LENGTH_LONG).show();
                  Log.w(TAG, getString(R.string.low_storage_error));
              }
          }
  
          mCameraSource = new CameraSource.Builder(context, detector)
                  .setFacing(CameraSource.CAMERA_FACING_FRONT)
                  .setRequestedFps(fps)
                  .build();
      }
  </code></pre>
  
  <p>When it is about to build the face detector an exception occurs (See below). Following, the code checks if the detector <code>isOperational()</code>, which returns false. The exception shown is:</p>
  
  <pre><code>2019-05-22 16:09:48.128 27557-27557/com.xxx.xxx.xxx W/DynamiteModule: Local module descriptor class for com.google.android.gms.vision.dynamite.face not found.
  2019-05-22 16:09:48.134 25402-25415/? W/ProviderHelper: Unknown dynamite feature vision.dynamite.face
  2019-05-22 16:09:48.140 27557-27557/com.xxx.xxx.xxx I/DynamiteModule: Considering local module com.google.android.gms.vision.dynamite.face:0 and remote module com.google.android.gms.vision.dynamite.face:0
  2019-05-22 16:09:48.140 27557-27557/com.xxx.xxx.xxx D/FaceNativeHandle: Cannot load feature, fall back to load whole module.
  2019-05-22 16:09:48.142 27557-27557/com.xxx.xxx.xxx W/DynamiteModule: Local module descriptor class for com.google.android.gms.vision.dynamite not found.
  2019-05-22 16:09:48.144 25402-25415/? W/ProviderHelper: Unknown dynamite feature vision.dynamite
  2019-05-22 16:09:48.149 27557-27557/com.xxx.xxx.xxx I/DynamiteModule: Considering local module com.google.android.gms.vision.dynamite:0 and remote module com.google.android.gms.vision.dynamite:0
  2019-05-22 16:09:48.154 27557-27557/com.xxx.xxx.xxx E/FaceNativeHandle: Error Loading module
      com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module found. Local version is 0 and remote version is 0.
          at com.google.android.gms.dynamite.DynamiteModule.load(Unknown Source:8)
          at com.google.android.gms.internal.vision.zzm.zzq(Unknown Source:28)
          at com.google.android.gms.vision.face.internal.client.zzc.&lt;init&gt;(Unknown Source:3)
          at com.google.android.gms.vision.face.FaceDetector$Builder.build(Unknown Source:40)
          at com.xxx.xxx.xxx.activities.Activity1.createCameraSource(Activity1.java:128)
          at com.xxx.xxx.xxx.activities.Activity1.onCreate(Activity1.java:111)
          at android.app.Activity.performCreate(Activity.java:7023)
          at android.app.Activity.performCreate(Activity.java:7014)
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2758)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2883)
          at android.app.ActivityThread.-wrap11(Unknown Source:0)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1613)
          at android.os.Handler.dispatchMessage(Handler.java:106)
          at android.os.Looper.loop(Looper.java:164)
          at android.app.ActivityThread.main(ActivityThread.java:6523)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
  2019-05-22 16:09:48.154 27557-27557/com.xxx.xxx.xxx W/FaceNativeHandle: Native handle not yet available. Reverting to no-op handle.
  </code></pre>
  
  <p>Once the application is installed on the phone, a line in the <code>AndroidManifest.xml</code> should inform the mobile app to download the appropriate face detection lib for the particular device. However, this seems to happen only when the device is reset to the factory settings and the first time the app is installed. If I re-install the app through Android Studio for example, then the app is not able to find the particular module.</p>
  
  <pre class="lang-java prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.xxx.xxx.xxx"
      android:installLocation="auto"&gt;
  
      &lt;uses-permission
          android:name="android.permission.INTERNET"
          android:required="true" /&gt;
  
      &lt;uses-permission-sdk-23
          android:name="android.permission.WRITE_EXTERNAL_STORAGE"
          android:required="true" /&gt;
      &lt;uses-permission-sdk-23
          android:name="android.permission.READ_EXTERNAL_STORAGE"
          android:required="true" /&gt;
  
      &lt;uses-permission
          android:name="android.permission.CAMERA"
          android:required="true" /&gt;
      &lt;uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" /&gt;
  
      &lt;uses-feature android:name="android.hardware.camera" /&gt;
      &lt;uses-feature android:name="android.hardware.camera.front" /&gt;
      &lt;uses-feature android:name="android.hardware.camera.autofocus" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:label="@string/app_name"
          android:largeHeap="true"
          android:supportsRtl="true"&gt;
          &lt;meta-data
              android:name="com.google.android.gms.version"
              android:value="@integer/google_play_services_version" /&gt;
          &lt;meta-data
              android:name="com.google.android.gms.vision.DEPENDENCIES"
              android:value="face" /&gt;
  
          &lt;activity
              android:name=".activities.Activity1"
              android:screenOrientation="portrait" /&gt;
          &lt;activity
              android:name=".activities.Activity2"
              android:screenOrientation="portrait" /&gt;
          &lt;activity
              android:name=".activities.Activity3"
              android:screenOrientation="portrait" /&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>We are using Google Play Services 17.0.2</p>
  
  <pre class="lang-java prettyprint-override"><code>implementation 'com.google.android.gms:play-services-vision:17.0.2'
  </code></pre>
  
  <p>We have checked and tried the following:</p>
  
  <ul>
  <li><strong>Clearing the data and cache</strong> of the Google Play services/Google Play Store/mobile app.</li>
  <li><strong>Free space</strong>. The device has 8GB of memory out of which 3.82GB is free space.</li>
  <li><strong>Storage permissions</strong>. The app has storage permissions and <code>android:installLocation="auto"</code></li>
  <li><strong>Internet connection</strong>. The device has active WiFi internet connection and the appropriate internet permissions.</li>
  </ul>
  
  <p>The library works perfectly fine on other devices in any situation. On the aforementioned devices it works only the first time the app is deployed after factory reset.</p>