Android refuses an APK with app not installed, package appears to be invalid
Fix it fast
Most common cause, 1 of 4The APK is a test-only build made by Android Studio Run
On your own test device, pass -t so adb accepts a test APK.
# your own device
adb install -t app-debug.apk
# an APK to share
./gradlew assembleReleaseShort answer
App not installed as package appears to be invalid is one dialog for several install failures: a test-only APK from Android Studio Run, an unsigned release build, a v1-only signature on Android 11 or newer, or a lower versionCode than the installed copy. Run adb install on the same file to read the real failure code, then fix that cause.
Which cause do you have?
The phone's dialog hides the reason. Connect the device with USB debugging on and install the same file with adb: the failure code it prints (TEST_ONLY, NO_CERTIFICATES, VERSION_DOWNGRADE and so on) names the cause.
adb install path/to/app.apkThen find the line you see in this list and open its fix:
- 1The APK is a test-only build made by Android Studio Run
adb reports INSTALL_FAILED_TEST_ONLY, and the file was taken from the build folder after pressing Run or Debug - 2The release APK was never signed
adb reports INSTALL_PARSE_FAILED_NO_CERTIFICATES, or apksigner verify fails on the file - 3The APK has only a v1 (JAR) signature and targets API 30 or higher
The APK was signed by an older tool or a custom script, installs on Android 10, and fails on Android 11 and newer - 4A newer version of the same app is already on the phone
adb reports INSTALL_FAILED_VERSION_DOWNGRADE; the same APK installs fine on a clean emulator
What does the error look like?
App not installed as package appears to be invalid.App not installed.
Cause 1 of 4
The APK is a test-only build made by Android Studio Run
You seeadb reports INSTALL_FAILED_TEST_ONLY, and the file was taken from the build folder after pressing Run or Debug
Check
The installer says the package appears to be invalid because the APK carries android:testOnly. Android's adb guide says Gradle makes such a test APK when you only run or debug the app, and the manifest reference says this kind of APK installs only through adb.
adb install app-debug.apkFix
On your own test device, pass -t so adb accepts a test APK. To give the app to anyone else, build a signed release APK instead of copying the Run output.
# your own device
adb install -t app-debug.apk
# an APK to share
./gradlew assembleReleaseVerify
The install command ends without a failure code and the app icon appears on the device.
adb shell pm list packages com.example.myappConfirmed by developer.android.com
Cause 2 of 4
The release APK was never signed
You seeadb reports INSTALL_PARSE_FAILED_NO_CERTIFICATES, or apksigner verify fails on the file
Check
A release build with no signingConfig comes out without any certificate. AOSP maps the no-certificates parse failure to the invalid status, so the phone shows the package appears to be invalid. The Android build guide says a release APK must be signed with your private key.
apksigner verify app-release.apkFix
Add a signingConfigs block to the module build.gradle.kts and point the release build type at it, then rebuild. Keep the passwords out of the file in real projects.
android {
signingConfigs {
create("release") {
storeFile = file("my-release-key.jks")
storePassword = "password"
keyAlias = "my-alias"
keyPassword = "password"
}
}
buildTypes {
getByName("release") {
signingConfig = signingConfigs.getByName("release")
}
}
}Verify
apksigner verify finishes without an error and adb install no longer reports a failure code.
apksigner verify app-release.apk && adb install app-release.apkConfirmed by developer.android.com
Cause 3 of 4
The APK has only a v1 (JAR) signature and targets API 30 or higher
You seeThe APK was signed by an older tool or a custom script, installs on Android 10, and fails on Android 11 and newer
Check
Android 11 behavior changes say apps targeting API level 30 that are signed only with APK Signature Scheme v1 cannot be installed or updated on Android 11 devices. Print the signature details in verbose mode to see which schemes are present.
apksigner verify -v app-release.apkFix
Sign the APK with apksigner, which picks the schemes from the min and max SDK levels, instead of jarsigner. Align it with zipalign before signing.
zipalign -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk
apksigner sign --ks my-release-key.jks --out my-app-release.apk my-app-unsigned-aligned.apkVerify
The verbose check now reports v2 or a later scheme, and the APK installs on an Android 11+ phone.
apksigner verify -v my-app-release.apkConfirmed by developer.android.com
Cause 4 of 4
A newer version of the same app is already on the phone
You seeadb reports INSTALL_FAILED_VERSION_DOWNGRADE; the same APK installs fine on a clean emulator
Check
Android compares versionCode and blocks an APK whose number is lower than the installed copy. AOSP's install status table sends that downgrade failure to the same invalid-package dialog, which is why the message looks unrelated.
adb shell pm list packages com.example.myappFix
Raise versionCode in defaultConfig above the installed build, or remove the installed copy first. Uninstalling deletes that app's data on the device.
# option 1: build.gradle.kts, defaultConfig { versionCode = 42 }
# option 2: remove the installed copy, then install again
adb shell pm uninstall com.example.myapp
adb install app-release.apkVerify
The install completes and the app opens at the new version.
adb install app-release.apkConfirmed by developer.android.com
How do I stop it coming back?
- Share builds only from a signed release variant or an internal testing track, never from the folder Android Studio Run writes to.
- Run apksigner verify -v on every APK in CI before it is uploaded or sent to testers.
- Increase versionCode on every build you hand out, so a tester's phone never holds a higher number than the new file.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine on the same stack: QistLock, Nuclear Home Video.