In this small blog, we will discuss how to run the release Variant of the app and enable logcat while running release app.
After the successful build the application we have to test that app very well for the application stability. In general, you should focus your Android tests on testing the business logic of your application. A good rule of thumb is to have the following distribution of tests:
- 70-80 % unit tests to ensure the stability of your code basis
- 20-30 % functional tests to ensure that the application really works
- some cross functional tests if your application integrates intensively with other Application components
we can see that the max percentage of the application testing is the unit testing which is done on code basis or we can say that the developer side.
It is good practice in Android testing to test the release version of the application instead of the debug version of Application.
How to run the release Variant of the app
Follow the below steps,
- First, select the build variant to Release,
Then run the application, then an edit configuration screen will be Open.
- At the bottom of that screen, an error will be shown, and the right of that error an fix button will be shown, we have to click on that fix button,
- After clicking that fix button, then the project structure window will be opened,
then you have to click on plus sign to add the signing configuration,
Select your key store path, and fill that form. - After filled that form go to flavor tab just right of current tab(signing), select you created signing config. Then simply click ok.
- After all this, your work is finished now. The Project is now syncing. After successfully sync there will be shown the signing config to build.gradle, and in your default config or selected flavor there will be a line of signing config added,
Now you can run your release application directly in your device without generation of the signed apk.
Enable logcat while running Release build of application
Follow the below simple steps,
- Add the android:debuggable in AndroidManifest.xml
12345<application// ...android:debuggable="true"// ...</application> - And then add the checkReleaseBuilds false in build.gradle,
1234567android {// ...lintOptions {checkReleaseBuilds false}// ...}
Now you have successfully enable the logcat while running release version of the app.
Note: After completing the test don’t forget to remove or comment above block of code.
Thanks for read this blog, may be this is help full to you. Stay cool and Stay updated.