How to calculate the checksum of the apk programmatically on the runtime,
so I can prevent a repackaged or recompiled apk from being able to do any harm (tamper prevention)
even if the resource files are changed in apk, the checksum needs to get changed.
gradle and api version which i am using currently
minsdkversion: 28
target sdk version: 33
gradle version :6.6.1
What I have come up with so far, is to calculate the checksum of the applicationInfo.publicSourceDir ,
still we dint get exact result.
so is there any way to calculate the checksum of the apk programmatically on the runtime.
Related
Trying to upload the version 39 of the app, the error message I get is:
Error uploading 'foo.bar.baz'
Version 38 of this app cannot be downloaded by any devices as they will all receive APKs with higher version codes. [403]
Screenshot:
What does this exactly mean? I'm trying to publish as "Alpha" from VisualStudio for Mac (the current version 38 of the alpha channel was uploaded manually.)
The Version number (integer-based) is set via the versionCode in the manifest must be increased each time you submit to the Play Store no matter if it is submitted as an Alpha, Beta, or Release APK.
Either via the Project Options / Build / Android Application :
Or via manually editing the AndroidManifest.xml:
android:versionCode="18"
Seems to be a bug in Visual Studio for Mac, so I reported it here. Hopefully they fix it soon.
If I remember correctly I've had a similar issue when I was trying to update an apk with higher version code to beta, when there was still apk with lower version code in alpha.
Since you are trying to upgrade on alpha, maybe you have an apk on internal test track with version code 38? If that is the case, I would deactivate version uploaded to internal test tract (or update it to version code 39) and then update version on alpha
I'm developing an Android app using Xamarin latest version and Visual Studio latest version aiming Android SDK 8.0. The app is in Beta track (no release yet). I've been publishing updates of my app for 2 months using Google Play console, but something weird happened on my last update, because download size of my app growed from 14.16 MB to 29.80 MB and I haven't done anything different in my last update.
My app apk has always been 28 - 29 MB on disk (.apk size) and download size 14 MB aprox. In my last update I haven't done anything particulary big, just changed code logic and added 4 new resources (pngs total size: 43KB), no new dlls o references, no new componentes. If I use Android Studio apk analyzer on my last apk update, it says my download size should be 13,4 MB, but it seems that Google Play console does not want to reduce download size any more.
Android Studio shows download size should be 13,4 MB, but download size is actually 29 MB:
Pls your help. Thanks.
I updated Visual Studio from version 15.7.1 to 15.7.3
Visual Studio 15.7.1 to 15.7.3 = Xamarin.Android 8.3.0.19 to 8.3.3.2, consult releases.xamarin.com for details.
So the Mono runtime shared library got updated, thus the basically the whole apk is being downloaded again.
Have you tried Linking your app on release ?
Xamarin.Android applications use a linker to reduce the size of the application. The linker employes static analysis of your application to determine which assemblies are actually used, which types are actually used, and which members are actually used.
Used correctly it can cut your app size in half.(I normally only do this for release builds)
You can get more information here
How to know the minimum device requirements to run my app in terms of memory and space. Is it through the minimum API which is 21 in my app or I need to monitor or calculate something. For space I build the APK with proguard true and it is 32,628kb while when I install it 50.79MB. Shall I say minimum space is 50.79MB?.
Any help is appreciated.
it will be fine when you set requirement that this app requires API 21,and the size of your apk is important not your debug apk size, the specify size should be your released apk size.
As far as I know there is no rocket science behind that. Check this thread: Why does my app size on device differ than the APK or Play store size
Quoting from #PFROLIM:
When installing an APK in android system, what's installed is the DEX
file. Which contains your code, resources etc compiled as binaries.
Your dex is generally the same size of your apk, unless you have
resources not compiled in assets.
Well, we all know that. What's not widelly spread is that android
SAVES your original apk too. Perhaps for reinstalling in case of
errors or for some other reasons.
That's why the amount of memory of our apps is the double in system.
It's the sum of the size of the original apk and the installed dex.
I have uploaded two APK files into the Google Play store. One is a newer version and one is an older version. The newer version is the active one since it has a higher versionName and Code. Now I found some bugs in the newer version and I want to delete it from the Play Store and activate the older version. Google Play won't let me deactivate the newer one and activate the older one again, since it has a lower versionName and code.
The problem is that I'm am not the developer and did not build the app. The developer is in another country and it is difficult to get hold of them.
What can I do to reactivate the older version again? I know one solution would be to change the versionName and Code. I only have the apk file, can I change those details in Eclipse with only the apk file and very little experience in eclipse or developing android apps?
Thank You
You can't rebuild a new version of an apk from the apk itself.
Have the app developer do the following:
Rebuild project in its previous state with higher version number (must be higher than all previously submitted versions)
Resubmit
From Google's Android "Developer Console" page:
Note that rollbacks aren’t supported due to the app versioning
requirements of the Android platform. If you need to rollback,
consider launching a previous APK with a new version number. However,
this practice should be used only as a last resort, as users will lose
access to new features and your old app may not be forward-compatible
with your server changes or data formats, so be sure to run alpha and
beta tests of your updates.
A good strategy is, when creating a build, modify the manifest to build say a version 2.0 = 39 AND again 2.05 = 45 and generate these two apks which will obviously do the same thing.
Later, when build 2.01 = 40 is in production and you find an error, you can jump back to the old version by uploading the 2.05 = 45 you created earlier.
You have 5 opportunities to back track while releasing 40, 41, 42, 43 and 44 to go back to earlier functionality!
Do this for each build and you can always go back to an earlier version which has been pre compiled and built but with a higher version number than currently in production.
You will not be able to change the APK file without having the signing certificate.
You should be able to revert to an older version, assuming you didn't change the level of API support.
Presumably, go to the Dev console, select the APK tab, hit the "Advanced Mode" option, deactivate the current version and hit "Reactivate" for the version you want.
I have signed the application using Eclipse's Export Wizard. When I published this, users started complaining that the application is behaving incorrectly. (Basically, the APK did not have necessary images & audio and hence showing incorrect behaviour).
Some information on Application and Signing which I have tried.
I have a lite version and paid version. Both are signed with same keypair. The lite version is working perfectly and full version is giving error.
I have tried to export the signed packages again and tried to install directly in device (instead of uploading to market). Same behaviour (i.e Lite apps works correctly and full version not proper)
Both Full Version and Lite Version uses shared Library (Code base is identical. Differences as follows.
Full Version has 5 times the resources of lite version. The lite version apk is ~2.6MB and full version is ~10.4MB. In Full Version I have 170 images (mostly png's of 5-10 KB) and ~55mp3 files. In Lite Version I have 45 images and 15 mp3s
Full Version has LVL (License Verification) implemented and Lite Version doesnot. Once LVL is passed, the code simply calls the Library Class
If I use Eclipse to build and deploy full version to phone (or emulator), it works correctly. (I guess this build and deploy will use debug key for signing)
I have error handling within the code to show code to show a dummypic (a question mark) if resource is missing. All my images are replaced with that question mark. Just to add.. This dummypic is in the Library and all other resources(images) are in Full Version.
I have checked the resources by renaming the signed apk file to .zip (thanks to NickT for suggesting this approach). All resource files (audio and images) are present in the zip file.
Any help is appreciated. The application is already in market and hence would like to minimise adverse impact.
Removed LVL. Still same error
Tried commenting the LVL code and directly calling the intent. Still same error.
By commenting the LVL, the code base for Lite and Full Version is identical. Only the resouce count is different. The full version has all the resources of Lite Version + ~5times the resource.
Update
This is how I temporarily fixed it.
I removed the library project and moved all classes and resources to the Implementation Project (Full Version). Now it is working.
As said, this is a temp fix only. I still need to know how I can fix this with library. Else I will have to create a lot of duplication of code.
My bet would be that it has to do with permissions.
The app that is being installed first, will have read-write permissions to that folder, the other will not.
Try using a ContentProvider to make your images accesible for both apps!
The sign shouldn't affect your code. I think the problem must be in the source code of Paid version.
Do you test in emulator? from eclipse? You can test the signed apk in emulator too through "adb install application-signed.apk".
I think you should uninstall and then re-install app, it happens sometimes, when your phone already has the application and you install it again with different resources and files without uninstalling(but overriding), it gives odd behavior,
try uninstall and then re-install should work for you.
I am not sure but i think no two apps of the same package name can co exist in a single device. try installing the apps in two different devices.
Two suggestions:
1) Do you have proguard enabled? If yes, try disabling it and test. If it works, you might need to update your proguard.cfg (probably with some -keep public class)
2) Delete your R.java manually and recompile your full version only!
I encountered this problem with Android projects using other Android Library projects. It looks like the AAPT (or an eclipse ADT part) sometimes fails when creating the R-file ids (So the resources are present, but the id's are not correct).
What quickly fixed the issue for me: Close the "master" project and reopen it having the Build Automatically option set or make a clean&rebuild on this project. The next exported APK shouldn't have the resources-not-found issue.
Maybe you let a debug flag into the Manifest file ?