• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Launch failed: Installation failed. Failure [INSTALL_FAILED_TEST_ONLY

Panaviotis

Lurker
Feb 22, 2022
3
1
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.

upload_2022-3-8_20-23-58.png


I connect my phone to the usb port and with the command line:
upload_2022-3-8_20-27-22.png


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

Java:
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [   
        {
            "type": "android",
            "request": "attach",
            "name": "Android Attach",
            "appSrcRoot": "${workspaceRoot}/src/main",
            "adbSocket": "localhost:5037",
            "processId": "${command:PickAndroidProcess}"
        },
       
        {
            "type": "android",
            "request": "launch",
            "name": "Android launch",
            "appSrcRoot": "${workspaceRoot}/src/main",
            "apkFile": "${workspaceRoot}/build/outputs/apk/debug/app-debug.apk",
            "adbSocket": "localhost:5037"
        }
    ]
}

I run it and get this message:
Checking build
Searching for devices...
Found 1 device
Deploying current build...
Installing...
Launch failed: Installation failed. Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

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)
 
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

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)

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

...and worked!
Thank you all!
 
Last edited:
  • Like
Reactions: James_Watson
Upvote 0
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)

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

...and worked!
Thank you all!

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
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones