Now I need to do a performance test on a feature of the project app, mainly testing how much power it consumes.
1. The way I think about it is that I need to test on the same phone, the same app that needs to be installed on the phone two times, the second installation does not overwrite the first installation.
In Android Studio, modify the Defaultconfig in Build.gradule directly.
Modify or add in the inside
ApplicationID "***.***.***"
As a result, two applications exist at the same time.
2. Next, when reading Versioncode (at Androidmanifest.xml),
Used a
Context.getpackagemanager (). Getpackageinfo (
PackageName, 0). Versioncode
Where PackageName was written directly as a string, resulting in the modification of ApplicationID without changing back
Next, I would have directly found Defaultproductflavor's Getapplicationid, intending to quote directly, to find
Com.android.builder.core can not directly reference (this I have to check the reference method) Finally, I directly quoted Context.getpackagename (), only to succeed.
Questions about using ApplicationID in Android Studio