1. Are you ready for the Galaxy S20? Here is everything we know so far!

Launch failed: Installation failed. Failure [INSTALL_FAILED_TEST_ONLY

Discussion in 'Android Development' started by Panaviotis, Mar 8, 2022.

  1. Panaviotis

    Panaviotis Lurker
    Thread Starter

    Hi everybody.
    Android Studio is much too heavy for my laptop...so...
    I 'm trying to build an android app using VSCode with Android extension by adelphes.


    I connect my phone to the usb port and with the command line:

    In my VSCode I have opened the project and have made the launch.json:

    Code (Java):
    1. {
    2.     // Use IntelliSense to learn about possible attributes.
    3.     // Hover to view descriptions of existing attributes.
    4.     // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    5.     "version": "0.2.0",
    6.     "configurations": [  
    7.         {
    8.             "type": "android",
    9.             "request": "attach",
    10.             "name": "Android Attach",
    11.             "appSrcRoot": "${workspaceRoot}/src/main",
    12.             "adbSocket": "localhost:5037",
    13.             "processId": "${command:PickAndroidProcess}"
    14.         },
    16.         {
    17.             "type": "android",
    18.             "request": "launch",
    19.             "name": "Android launch",
    20.             "appSrcRoot": "${workspaceRoot}/src/main",
    21.             "apkFile": "${workspaceRoot}/build/outputs/apk/debug/app-debug.apk",
    22.             "adbSocket": "localhost:5037"
    23.         }
    24.     ]
    25. }
    I run it and get this message:
    What can I do to fix it? (I think on my phone I should see some message asking me if I allow to install the app, but no such message appears)

    1. Download the Forums for Android™ app!


  2. GameTheory

    GameTheory Android Expert

    Does your AndroidManifest.xml have (android:testOnly="true")? If it does, change it to "false" or remove it.
  3. Panaviotis

    Panaviotis Lurker
    Thread Starter

    No it has not.

    I 've also tried (in file gradle.properties):
    Code (Text):
    1. android.injected.testOnly=false
    ...without any result.
    #3 Panaviotis, Mar 8, 2022
    Last edited: Mar 8, 2022
  4. James_Watson

    James_Watson Android Enthusiast

    That means the APK can only be installed via adb (which Android Studio uses).

    So, try to run in the command line:
    adb install -t yourapp.apk
    GameTheory and Panaviotis like this.
  5. Panaviotis

    Panaviotis Lurker
    Thread Starter

    No apk is produced.
    So it also means that the built failed.
    (or, because it 's supposed to get installed directly on the phone, it' s not saved on my pc)

    -I built it with the command line: gradlew assembleDebug
    -then adb install -t myapp.apk

    ...and worked!
    Thank you all!
    #5 Panaviotis, Mar 10, 2022
    Last edited: Mar 10, 2022
    James_Watson likes this.
  6. James_Watson

    James_Watson Android Enthusiast

    In general, either Android Studio or VS Code will build and generate a debug version apk file on your PC. You may locate that apk file on your PC before running the command line: adb install.
    Anyway, the problem is solved. :D

Share This Page