Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

run fails with INSTALL_FAILED_TEST_ONLY

I'm new using calabash to test Android applications.

I implemented some tests to validate an apk implemented with Android Studio 3.0.1 and Gradle version 2.3.3 and that works fine. The problem appears when i try to execute the tests to validate a new app created with Gradle version 3.0.1 and Kotlin (same AS). Executing the command:

bundle exec calabash-android run app-release.apk

i'm getting this:

adb: failed to install /Users/sonia/Documents/calabash-test-android/app-release.apk: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]
  Scenario: As a valid user I can log into my app #features/my_first.feature:3
  undefined method `chomp' for nil:NilClass (NoMethodError)
  ./features/support/app_installation_hooks.rb:18:in `Before'
  Will not start test server because of previous failures. (RuntimeError)
  ./features/support/app_life_cycle_hooks.rb:5:in `Before'
    When I press "Login"                          # calabash-android-0.9.2/lib/calabash-android/steps/press_button_steps.rb:17
    Then I see "Welcome to coolest app ever"      # calabash-android-0.9.2/lib/calabash-android/steps/assert_steps.rb:5

Failing Scenarios:
cucumber features/my_first.feature:3 # Scenario: As a valid user I can log into my app

1 scenario (1 failed)
2 steps (2 skipped)
0m4.553s

All the other settings defined in AS in the new app are the same as the old app.

Someone knows if there is a problem with the Gradle version?

like image 708
Andrews Avatar asked Nov 30 '22 14:11

Andrews


1 Answers

The Official docs say this

Note: The Run button builds an APK with testOnly="true", which means the APK can only be installed via adb (which Android Studio uses). If you want a debuggable APK that people can install without adb, select your debug variant and click Build > Build APK(s).

Even I force to adding below line to application tag in AndroidManifest.xml

android:testOnly="false"

The Android Studio Run button overrides my setting of it.

I find a working method to stop Android Studio from injecting the testOnly property to application tag.

Add the below line:

android.injected.testOnly=false

to gradle.properties gradle config file in your project.

like image 185
Tshunglee Avatar answered Dec 03 '22 03:12

Tshunglee