mercredi 3 août 2016

Android instrumentation test errors due to com.google.android.gms.version meta data

I am attempting to write an instrumentation test for my Android app. When I run my test, and it hits the section of my code that attempts to use the com.google.android.gms.vision.face.FaceDetector library, the test framework throws the follow error:

A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

However, my AndroidManifest.xml already does contain that exact meta data tag, right here:

<application
        android:allowBackup="true"
        android:hardwareAccelerated="true"
        android:icon="@drawable/icon"
        android:label="NeuralEye-FaceID-2"
        android:theme="@style/Theme.AppCompat"
        android:largeHeap="true">
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="com.google.android.gms.vision.DEPENDENCIES"
            android:value="face" />

What am I missing? My instrumented test looks something like this:

@RunWith(AndroidJUnit4.class)
public class FeatureExtractionTest {


    public FeatureExtraction mFeatureExtraction;

    public ConcurrentSkipListSet<String> skipList = new ConcurrentSkipListSet();

    @Before
    public void createFeatureExtraction() {
        mFeatureExtraction = new FeatureExtraction();
    }

    @Test
    public void testGetFeatures() throws Exception {
        File file = new File("new.txt");
        Context ctx = InstrumentationRegistry.getContext();
        mFeatureExtraction.getFeatures(file, skipList, ctx);
    }
}

Any help is appreciated. I have already found a miriad of SO answers that all say add the meta-data tag to the manifest (this one, for example), however I have already have it added and the test still will not run past the FaceDetector library.

Aucun commentaire:

Enregistrer un commentaire