Sometimes it can be useful to make modifications to an Apps AndroidManifest.xml. When you have developed an app years ago and you want to change some propriety's and you deleted/lost the source code. When you have a very old android version and an app does not install because of some artificial limitation from developer even when the app is just a simple app like a text editor. Or you want to use an app like a file manager from your old phone on your new phone but the phone maker made a dependency to one file in the system so the app only installs on this phone and not any other. In such cases this method would work.
You also need to know how to work with text xml files.
This also ONLY works on Linux and WSL.
-Download apktool.
-You need to Unpack you apk. For that you use apktool:
java -jar apktool.jar d MyApp.apk
-Now you can change the AndroidManifest.xml and make your needed changes. If you are doing this to install an incompatible app, it can help to install the APK with help from android adb to see the exact error message. That can be a really good starting point.
-After that you need to Repack the apk. For that do the following:
java -jar apktool.jar b MyApp
You find your Repacked apk inside the dist folder in the Project folder (In my case /MyApp/dist/MyApp.apk)
Now you need to Resign the APK. You also need to generate a certificate for that. Java has a key tool build in in its jdk. You need to go into the java folder to make sure you use the same version of java to create a certificate and sign an app. I use arch. If the path is different on your distro change the path accordingly.
/usr/lib/jvm/java-8-openjdk/bin/keytool -genkey -v -keystore /home/#YOURNAME#/keyStore.keystore -alias app -keyalg RSA -keysize 2048 -validity 10000
Fill the Details with the needed things. How real these are is on you.
Now resign your app:
/usr/lib/jvm/java-8-openjdk/bin/jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore /home/#YOURNAME#/keyStore.keystore home/#YOURNAME#/MyApp/dist/MyApp.apk app
If everything has gone right your APK is finished and can be installed.