22 April 2024 Leave a comment Tech-Help
Encountering the INSTALL_FAILED_TEST_ONLY
error during an APK installation can be a stumbling block when you’re trying to test or deploy your Android application. This guide will walk you through some practical steps to overcome this issue.
Understanding the INSTALL_FAILED_TEST_ONLY Error
This error occurs when you attempt to install an APK that is marked as test-only. This can happen if the android:testOnly
attribute is set to true
in your AndroidManifest.xml file or if the APK was built in a certain way that it’s only intended for testing purposes.
How to Resolve the Error
Here are some methods that can help you resolve the INSTALL_FAILED_TEST_ONLY
error:
Modify AndroidManifest.xml
Inspect your AndroidManifest.xml
file and look for the android:testOnly
attribute within the <application>
tag. You have two options:
- Change
android:testOnly="true"
toandroid:testOnly="false"
. - Remove the
android:testOnly
attribute entirely.
Use the -t Option with ADB Install
If you wish to keep the APK as test-only, you can use the -t
option with the ADB install command:
adb install -t path/to/your/app.apk
Building the APK for Release
If you’re using Android Studio, ensure that you’re building the APK for release properly. Avoid using the “Run” button for generating the release APK. Instead, follow these steps:
- Clean the build from the Build menu.
- Then select Build > Build APK(s).
This will create an APK that’s ready for installation through the ADB command or other methods.
Additional Gradle Configuration
In some cases, adding the following line to your gradle.properties
file can resolve the issue:
android.injected.testOnly=false
Repeato: Streamlining Your App Testing
While resolving ADB installation issues is one step towards a robust app testing process, Repeato can take your testing to the next level. As a no-code test automation tool for iOS and Android, Repeato allows you to create, run, and maintain automated tests with ease. It’s fast to edit and run tests, utilizing computer vision and AI to ensure compatibility across various app frameworks, such as React Native, Flutter, and Unity.
Moreover, Repeato comes with ADB on board, enabling you to execute ADB commands via script steps. This integration can be particularly useful when you need to interact with your Android devices during automated testing.
For more information on how Repeato can assist with your testing needs, please visit our product page: Repeato vs. Appium.
Conclusion
Resolving the INSTALL_FAILED_TEST_ONLY
error involves checking your APK’s configuration and using the appropriate ADB install options. By following the solutions outlined in this guide, you can overcome this hurdle and continue with your app development and testing workflow.