Collect: connectedDebugAndroidTest fails on API > 22

Created on 20 Sep 2018  ·  14Comments  ·  Source: getodk/collect

Software and hardware versions

Collect v1.17.x

Problem description

./gradlew connectedDebugAndroidTest results in failed tests.

I've tried on an Nexus 5X API 26 emulator and a Moto G5 running Android 7

Expected behavior

Other information

Starting 82 tests on Nexus_5X_API_26(AVD) - 8.0.0

org.odk.collect.android.GuidanceHintFormTest > guidanceVisibilityContentTest[Nexus_5X_API_26(AVD) - 8.0.0] SKIPPED

org.odk.collect.android.ResetAppStateTestCase > resetSettingsTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError
        at org.junit.Assert.fail(Assert.java:86)

org.odk.collect.android.ResetAppStateTestCase > resetOSMDroidTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError
        at org.junit.Assert.fail(Assert.java:86)

org.odk.collect.android.ResetAppStateTestCase > resetCacheTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively0(Native Method)

org.odk.collect.android.ResetAppStateTestCase > resetLayersTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively0(Native Method)

org.odk.collect.android.ResetAppStateTestCase > resetInstancesTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError
        at org.junit.Assert.fail(Assert.java:86)

org.odk.collect.android.ResetAppStateTestCase > resetFormsTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively0(Native Method)

org.odk.collect.android.SmsSubmissionMemoryTest > testMemoryConsumption[Nexus_5X_API_26(AVD) - 8.0.0] SKIPPED

org.odk.collect.android.dao.FormsDaoTest > updateInstanceTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively0(Native Method)

org.odk.collect.android.dao.FormsDaoTest > getFormsCursorForFormIdTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively0(Native Method)

org.odk.collect.android.dao.FormsDaoTest > getFormMediaPathTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively0(Native Method)

org.odk.collect.android.dao.FormsDaoTest > getAllFormsCursorTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively0(Native Method)

org.odk.collect.android.dao.FormsDaoTest > getFormsCursorForFormFilePathTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively0(Native Method)

org.odk.collect.android.dao.FormsDaoTest > getFormsCursorTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively0(Native Method)

org.odk.collect.android.dao.InstancesDaoTest > getUnsentInstancesCursorTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError: expected:<4> but was:<0>
        at org.junit.Assert.fail(Assert.java:88)

org.odk.collect.android.dao.InstancesDaoTest > updateInstanceTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError: expected:<1> but was:<0>
        at org.junit.Assert.fail(Assert.java:88)

org.odk.collect.android.dao.InstancesDaoTest > getInstancesCursorForFilePathTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError: expected:<1> but was:<0>
        at org.junit.Assert.fail(Assert.java:88)

org.odk.collect.android.dao.InstancesDaoTest > getSentInstancesCursorTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError: expected:<2> but was:<0>
        at org.junit.Assert.fail(Assert.java:88)

org.odk.collect.android.dao.InstancesDaoTest > getFinalizedInstancesCursorTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError: expected:<1> but was:<0>
        at org.junit.Assert.fail(Assert.java:88)

org.odk.collect.android.dao.InstancesDaoTest > getSavedInstancesCursorTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError: expected:<5> but was:<0>
        at org.junit.Assert.fail(Assert.java:88)

org.odk.collect.android.dao.InstancesDaoTest > getInstancesCursorForIdTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError: expected:<1> but was:<0>
        at org.junit.Assert.fail(Assert.java:88)

org.odk.collect.android.dao.InstancesDaoTest > getAllCompletedUndeletedInstancesCursorTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError: expected:<2> but was:<0>
        at org.junit.Assert.fail(Assert.java:88)

org.odk.collect.android.tasks.DownloadFormListTaskTest > shouldProcessAndReturnAFormList[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke interface method 'int android.database.Cursor.getCount()' on a null object reference
        at org.odk.collect.android.utilities.DownloadFormListUtils.isNewerFormVersionAvailable(DownloadFormListUtils.java:423)

org.odk.collect.android.tasks.InstanceServerUploaderTest > shouldUploadAnInstance[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively0(Native Method)

org.odk.collect.android.utilities.BitmapScaledToDisplayTest > scaleDownBitmapWhenNeeded[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError: expected:<500> but was:<333>
        at org.junit.Assert.fail(Assert.java:88)

org.odk.collect.android.utilities.CustomSQLiteQueryBuilderTestCase > addColumnTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
        at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)

org.odk.collect.android.utilities.CustomSQLiteQueryBuilderTestCase > dropTableTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
        at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)

org.odk.collect.android.utilities.CustomSQLiteQueryBuilderTestCase > copyTableTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
        at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)

org.odk.collect.android.utilities.CustomSQLiteQueryBuilderTestCase > renameTableTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
        at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)

org.odk.collect.android.utilities.FormIndexSavepointTest > saveAndReadFormIndexTest[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.AssertionError: expected:<-1, > but was:<null>
        at org.junit.Assert.fail(Assert.java:88)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormAndSettingsLevel1[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormAndSettingsLevel1(ImageConverterTest.java:261)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormAndSettingsLevel2[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormAndSettingsLevel2(ImageConverterTest.java:272)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormLevelOnly1[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormLevelOnly1(ImageConverterTest.java:74)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormLevelOnly2[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormLevelOnly2(ImageConverterTest.java:85)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormLevelOnly3[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormLevelOnly3(ImageConverterTest.java:96)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormLevelOnly4[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormLevelOnly4(ImageConverterTest.java:107)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormLevelOnly5[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormLevelOnly5(ImageConverterTest.java:118)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormLevelOnly6[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormLevelOnly6(ImageConverterTest.java:129)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormLevelOnly7[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormLevelOnly7(ImageConverterTest.java:140)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormLevelOnly8[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormLevelOnly8(ImageConverterTest.java:151)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormLevelOnly9[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormLevelOnly9(ImageConverterTest.java:162)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownSettingsLevelOnly1[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownSettingsLevelOnly1(ImageConverterTest.java:206)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownSettingsLevelOnly2[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownSettingsLevelOnly2(ImageConverterTest.java:217)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownSettingsLevelOnly3[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownSettingsLevelOnly3(ImageConverterTest.java:228)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownSettingsLevelOnly4[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownSettingsLevelOnly4(ImageConverterTest.java:239)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownSettingsLevelOnly5[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownSettingsLevelOnly5(ImageConverterTest.java:250)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormLevelOnly10[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormLevelOnly10(ImageConverterTest.java:173)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormLevelOnly11[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormLevelOnly11(ImageConverterTest.java:184)

org.odk.collect.android.utilities.ImageConverterTest > scaleImageDownFormLevelOnly12[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.scaleImageDownFormLevelOnly12(ImageConverterTest.java:195)

org.odk.collect.android.utilities.ImageConverterTest > rotateImage1[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.rotateImage1(ImageConverterTest.java:283)

org.odk.collect.android.utilities.ImageConverterTest > rotateImage2[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.rotateImage2(ImageConverterTest.java:294)

org.odk.collect.android.utilities.ImageConverterTest > rotateImage3[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.rotateImage3(ImageConverterTest.java:305)

org.odk.collect.android.utilities.ImageConverterTest > rotateImage4[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.rotateImage4(ImageConverterTest.java:316)

org.odk.collect.android.utilities.ImageConverterTest > rotateImage5[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.rotateImage5(ImageConverterTest.java:327)

org.odk.collect.android.utilities.ImageConverterTest > executeConversionWithoutAnySettings[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.executeConversionWithoutAnySettings(ImageConverterTest.java:63)

org.odk.collect.android.utilities.ImageConverterTest > rotateAndScaleDownImage[Nexus_5X_API_26(AVD) - 8.0.0] FAILED
        java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
        at org.odk.collect.android.utilities.ImageConverterTest.rotateAndScaleDownImage(ImageConverterTest.java:338)
Tests on Nexus_5X_API_26(AVD) - 8.0.0 failed: Test run failed to complete. Expected 82 tests, received 81
good first issue help wanted

All 14 comments

I notice you're running them on API 26. CircleCI runs them on API 21. I just ran them on an API 22 physical device and they all passed.

@AOS002 You mentioned BitmapScaledToDisplayTest > scaleDownBitmapWhenNeeded was failing in Slack. Was that the only test failing for you? What API level were you running them with?

This almost certainly has to do with the change in target API version.

I played around with GrantPermissionRules and I was able to get some of the tests running. Hopefully, that's a big hint for a new contributor to take this on.

@lognaturel I ran it on a Moto E4 Plus running Android 7.1(API 25). Initially it was failing only one test but, now I tried it again and it gives the same results as @yanokwa . I'll take this issue!

@opendatakit-bot claim

So I noticed that when I run the app from Android Studio it initially asks for permissions after which the app launches, if I run ./gradlew connectedDebugAndroidTest at this point only two tests fail InstanceServerUploaderTest > shouldUploadAnInstance & BitmapScaledToDisplayTest > scaleDownBitmapWhenNeeded but if I run the tests without running the app first I get the same output as @yanokwa . So it does seem like a permissions issue but I am not very sure why the other two tests fail. I think it expected a device id but that's missing and for the second test BitmapScaledToDisplayTest > scaleDownBitmapWhenNeeded I think there might be some issue with FileUtils.getBitmapScaledToDisplay because the expected height doesn't match the height returned by this function, this test failed for @yanokwa also with the same values, although I am not sure what that implies.

Starting 82 tests on Moto E (4) Plus - 7.1.1

org.odk.collect.android.GuidanceHintFormTest > guidanceVisibilityContentTest[Moto E (4) Plus - 7.1.1] SKIPPED 

org.odk.collect.android.SmsSubmissionMemoryTest > testMemoryConsumption[Moto E (4) Plus - 7.1.1] SKIPPED 

org.odk.collect.android.tasks.InstanceServerUploaderTest > shouldUploadAnInstance[Moto E (4) Plus - 7.1.1] FAILED 
        java.lang.AssertionError: Expected </submission?deviceID=> to match </submission\?deviceID=\w+%3A\w+>.
        at org.odk.collect.android.test.TestUtils.assertMatches(TestUtils.java:97)

org.odk.collect.android.utilities.BitmapScaledToDisplayTest > scaleDownBitmapWhenNeeded[Moto E (4) Plus - 7.1.1] FAILED 
        java.lang.AssertionError: expected:<500> but was:<333>
        at org.junit.Assert.fail(Assert.java:88)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':collect_app:connectedDebugAndroidTest'.
> There were failing tests. See the report at: file:///home/lola/collect/collect_app/build/reports/androidTests/connected/index.html

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':collect_app:connectedDebugAndroidTest'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
        at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
        at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:88)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:623)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:578)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:59)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:128)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:46)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
        at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:318)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:204)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:134)
        at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:109)
        at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:78)
        at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:75)
        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
        at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
        at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:75)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:49)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:32)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:64)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:29)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.GradleException: There were failing tests. See the report at: file:///home/lola/collect/collect_app/build/reports/androidTests/connected/index.html
        at com.android.build.gradle.internal.tasks.DeviceProviderInstrumentTestTask.runTests(DeviceProviderInstrumentTestTask.java:184)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:788)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:755)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
        ... 104 more


* Get more help at https://help.gradle.org

BUILD FAILED in 3m 56s
60 actionable tasks: 10 executed, 50 up-to-date

The deviceID issue may also be related to permissions. How is it set in the test? I'd probably start by debugging the test on a lower API version and seeing how the deviceID is set.

I'd also start by debugging scaleDownBitmapWhenNeeded to get a better sense of how it works and where the failure may be happening. You might learn something by debugging it on API <= 22 and then API > 22. I think the scaling code uses different methods for different API levels.

Hi! @lognaturel, I was able to fix the deviceID issue by using the GrantPermissionRule like @yanokwa had mentioned.
For the second test the FileUtils.getBitmapScaledToDisplay method uses options.inSampleSize = (int) scale to set the target scale for the image. In the documentation it says that it rounds down to the nearest power of two which it does in API 22 but doesn't do so in API 27, it just takes the value that is given. I was not able to find any new method or documentation on this change of behavior, but I did find that, here they have implemented their own method to calculate inSampleSize as a power of two.

I see a few possible solutions to this:

  1. Implement a function that makes sure the scale is a power of two.
  2. Change the test
  3. If there is a new method to be used, use that instead. But I count not find any.

@shobhitagarwal1612 You wrote the FileUtils.getBitmapScaledToDisplay test. Which of @AOS002's possible solutions do you prefer and why?

it says that it rounds down to the nearest power of two which it does in API 22 but doesn't do so in API 27, it just takes the value that is given.

If this is the case then the image resize function must not be scaling down the image to the required screen dimensions too for higher API levels. The best solution would be to fix the scaling factor instead of changing the test case

What do you think @yanokwa ?

BitmapScaledToDisplayTest.scaleDownBitmapWhenNeeded() is meant to scale the image down so that it fits the given window size right? because the last test in this method has an "expected height of image" that is greater than the window height, so I think this might also be an issue @shobhitagarwal1612.
This is because of the assumption that the decoder rounds down to the nearest power of two, so the scaling factor decreases and the image is not scaled enough to fit the window.

@shobhitagarwal1612 I wonder whether this is why we had the failing tests fixed at https://github.com/opendatakit/collect/pull/2097? Perhaps you ran on a API 27 device?

Can we have different tests for different API levels? That's what I would tend to suggest along with a really good comment. The power of 2 thing is for performance reasons so I don't think we should change it for lower API levels. But really, it's better to have exact scaling. My guess is that API 27 has some performance improvements that makes this possible and so so inSampleSize was modified but no one updated documentation. 🤷‍♀️

I'm not really bothered by the factor sometimes resulting in an insufficient scale down but if you are, one possible approach is described in #2097:

The thing that is not awesome about this scaling strategy is that in cases like that specific test, the image still doesn't fully fit on the screen. It might be better to go up to the next power of 2 instead.

I'm not really bothered by the factor sometimes resulting in an insufficient scale down .....

@lognaturel Is it because the loss won't be much? Also if we want to avoid this, and also maintain exact scaling when possible, I think we would need to scale depending on the API along with API dependent tests. Exact scaling for API>=27 and rounded up nearest power of two for <27.

Does this sound good?

Is it because the loss won't be much?

I'm assuming that the edges of an image are probably not critical to understanding its content and that, like you say, not too much will be cut off.

I think we would need to scale depending on the API along with API dependent tests

Yes, I agree. So the options are to leave the code as-is and have different tests or to both change the code and the tests to make sure an image never goes off the screen. You can pick!

Hello @AOS002, you have been unassigned from this issue because you have not updated this issue or any referenced pull requests for over 15 days.

You can reclaim this issue or claim any other issue by commenting @opendatakit-bot claim on that issue.

Thanks for your contributions, and hope to see you again soon!

Was this page helpful?
0 / 5 - 0 ratings