Re-compiling AndroidManifest.xml only - Android Q&A, Help & Troubleshooting

Is there a way to compile just AndroidManifest.xml?
I'm de-compiling an apk using --force-manifest flag in apktool and can't seem to be able to re-compile the manifest, so i'm unable to use the app. (I signed the apk after building)

Guyishay said:
Is there a way to compile just AndroidManifest.xml?
I'm de-compiling an apk using --force-manifest flag in apktool and can't seem to be able to re-compile the manifest, so i'm unable to use the app. (I signed the apk after building)
Click to expand...
Click to collapse
Hmm... I don't think that's possible, but you may get something similar, according to APKTOOL Documentation using these options:
Code:
--no-assets
Prevents decoding/copying of unknown asset files.
Code:
--no-res
This will prevent the decompile of resources. This keeps the resources.arsc intact without any decode. If only editing Java (smali) then this is the recommended action for faster decompile & rebuild
Code:
--no-src
This will prevent the disassembly of the dex file(s). This keeps the apk dex file(s) and simply moves it during build. If you are only editing the resources. This is the recommended action for faster disassemble & assemble

Related

Is it possible to use baksmali on the device

Basically I want to be able to decompile apks. And jar files directly on my phone. Can I do that?
Yes, you can. At least, for the most part. The main constraining factor is the small amount of memory available on the device.
1. run the dx util on baksmali.jar, to produce a classes.dex file
2. add the classes.dex file to a new jar (or you can just add it to baksmali.jar)
3. push the jar containing classes.dex to the device somewhere (let's say /data/local/baksmali.jar)
4. dalvikvm -classpath /data/local/baksmali.jar org.jf.baksmali.baksmali <normal baksmali options>
5. bonus points if you then proceded to run baksmali on baksmali.jar (and then the universe implodes)
note: I just tried this with the latest version of baksmali, and there's some weird issue with the baksmali jar file, where it contains duplicate entries of every class file, which causes dx to choke on it. I'll see if I can get that fixed soon, and get a new build out. In the meantime, you can probably find an older version without that problem.
Sweet, thanks for your input. I was out last night and I had this idea for an edit to make, only to become sad because I didn't have access to a computer.
This will help me out a lot.
JesusFreke said:
Yes, you can. At least, for the most part. The main constraining factor is the small amount of memory available on the device.
1. run the dx util on baksmali.jar, to produce a classes.dex file
2. add the classes.dex file to a new jar (or you can just add it to baksmali.jar)
3. push the jar containing classes.dex to the device somewhere (let's say /data/local/baksmali.jar)
4. dalvikvm -classpath /data/local/baksmali.jar org.jf.baksmali.baksmali <normal baksmali options>
5. bonus points if you then proceded to run baksmali on baksmali.jar (and then the universe implodes)
note: I just tried this with the latest version of baksmali, and there's some weird issue with the baksmali jar file, where it contains duplicate entries of every class file, which causes dx to choke on it. I'll see if I can get that fixed soon, and get a new build out. In the meantime, you can probably find an older version without that problem.
Click to expand...
Click to collapse
The problem seems to be within the buildprocess as the generated classes for baksmali and smali are added twice to the *-dev-jar-with-dependencies.jar. As I'm not familar with maven I didn't fixed the source of the error but I managed to get it working.
I attached a small pythonscript which is able to remove the dublicated files within the jar. Just run it over the file and get a fixed version which is processable by dx.
The script:
Code:
#!/usr/bin/python
import sys
from zipfile import *
if len(sys.argv) != 3:
print("Usage: %s input.jar output.jar" % sys.argv[0]);
sys.exit(-1)
input = ZipFile(sys.argv[1], "r")
output = ZipFile(sys.argv[2], "w")
seen = []
for file in input.namelist():
if file not in seen:
output.writestr(file, input.read(file))
seen.append(file)
else:
print("dub found: %s" % file)
input.close()
output.close()
sorry ...
Wrong place
JesusFreke said:
Yes, you can. At least, for the most part. The main constraining factor is the small amount of memory available on the device.
1. run the dx util on baksmali.jar, to produce a classes.dex file
2. add the classes.dex file to a new jar (or you can just add it to baksmali.jar)
3. push the jar containing classes.dex to the device somewhere (let's say /data/local/baksmali.jar)
4. dalvikvm -classpath /data/local/baksmali.jar org.jf.baksmali.baksmali <normal baksmali options>
5. bonus points if you then proceded to run baksmali on baksmali.jar (and then the universe implodes)
note: I just tried this with the latest version of baksmali, and there's some weird issue with the baksmali jar file, where it contains duplicate entries of every class file, which causes dx to choke on it. I'll see if I can get that fixed soon, and get a new build out. In the meantime, you can probably find an older version without that problem.
Click to expand...
Click to collapse
I realize this is a very old thread, but it is exactly what I am looking for However, it seems there are Java 8 features in smali/baksmali now and dx does not work. Is there a workaround for this or any other way to run smali/baksmali from terminal on Android? Thanks!
The older versions of smali may still work for you. Or what I've done is use Termux and download the jdk for arm64 and used the ndk to compile smali on my device.
Delgoth said:
The older versions of smali may still work for you. Or what I've done is use Termux and download the jdk for arm64 and used the ndk to compile smali on my device.
Click to expand...
Click to collapse
Thanks for the reply
However, I am not trying to compile smali on my device. I am trying to run the latest smali/baksmali on my device in Termux. Unfortunately, the older versions will not work for my needs. If you can help I would really appreciate it
But compiling the latest build of small on the device will allow you to use the latest build of smali.

[Q] APK modding Deskclock - Please Help

So i have this Deskclock.apk and i want to add this.
No Problem with the ".xml" Files. I can edit them easily after i decompile the apk with the "apkTool". But where will i find the ".java" Files? After decompiling the apk i only see ".smali".
So i found out that the ".java" files are in "classes.dex" from the apk.
I use "dex2jar" to get a ".jar" File.
Then i use "jd-gui" to get ".java" Files.
So i can edit it and put the needed Strings in the .java files.
But how to put them back to a "classes.dex" File which i can put back to the apk??
I hope i get a bit help here.
You can use APKTool. It will automaticly extract all the classes (.dex), resources (.asrc), then it will convert binary XML to human-readable XML, and it will also dissassemble the classes for you.
Just tell APKTool to decode the APK into a directory, then modify what you want, and finally encode it back to an APK. That's all.
Important: APKTool dissassembles. It doesn't decompile. The generated code won't be Java source. But you should be able to read it, and even edit it if you're familiar with jasmin. If you want Java source, please go over the Manual way.
Sent from my VS910 4G using XDA
Thx...I know how to use APKTool but i need to put the ".java" Files back into the "classes.dex". Thats my Problem.
There's info on the process here: http://stackoverflow.com/questions/10261147/converting-java-back-to-classes-dex
Essentially it looks like you need to compile the .java to .class files with javac and then create classes.dex with dx. Hope this link is helpful.

Edit xml file from existing apk / recompiling apk

Hey
I am currently struggeling at editing a xml file in an .apk that i got.
I've used this Jadx decompiler (wwwDOTjavadecompilersDOTcom) to decompile the apk, which gave me the following files and folders:
fs5.directuploadDOTnet/images/160129/ypnqz7xuDOTpng
All the files are human readable.
But how do I recompile it? Can I load it into the Android Studio?
fs5DOTdirectupload.net/images/160129/ho4vszubDOTpng
As you can see importing into android studio did not really work. The app couldn't be run.
Search for apktool here. It is what is used for decompiling and recompiling apks.

FIPS META-INF/HMAC.SHA256 (DEX modifies) ERROR

Hi,
I have a signed jar that cannot be allowed to be modified.
By adding it to the /libs folder in Android Studio, when the app is built into an .apk because of it (the .jar) being included in classes.dex the checksum changes and the jar's classes will crash.
Is there a way to import a jar into a project and ensure it does not get obfuscated/compressed/changed etc or kept outside of classes.dex and able to run the apk without problems?
I would have added it to the developers forum but I have a low post count.
Thanks in advance.

[SOLVED] Installing WebView (rooted Stock ROM)

I am trying to install a clean Android System WebView (packagename: com.android.webview) onto stock LG G5 RS988 RS98821d Android 7.0 that is rooted.
I downloaded an arm64 WebView APK from the Bromite Releases GitHub page:
https://github.com/bromite/bromite/releases
I tried installing the Bromite WebView APK to "/system/app/webview/" (0644 permissions) and rebooted, but the WebView implementation could not be used.
There are instructions regarding installing Bromite System WebView available:
https://github.com/bromite/bromite/wiki/Installing-SystemWebView
From my reading of the installation instructions, "res/xml/config_webview_packages.xml" from "/system/framework/framework-res.apk" must contain the an entry for the package with the particular package name ("com.android.webview" in this case).
After examining the stock "config_webview_packages.xml" member file, it appears that a reference to "com.android.webview" is not present. The "config_webview_packages.xml" XML file also appears to not be easily readable in a text editor. My guess is that it has some kind of signing.
What must be done to get the system to allow the newly installed WebView? My impression is that the "config_webview_packages.xml" XML file must be edited, but it is not clear how to do so, given that it does not appear to be just plain text.
I have attached a copy of the "config_webview_packages.xml" XML member file and the original framework-res.apk file zipped into a ZIP 2.0 archive.
XML files inside apks are compressed, you should unpack the framework-res.apk using a tool for apk editing, not just a zip archiver program. On Android, you can use APK Editor Pro, for example.
By the way, have you already uninstalled Chrome? If Chrome is installed, it will be forced as the standard WebView provider.
tremalnaik said:
XML files inside apks are compressed, you should unpack the framework-res.apk using a tool for apk editing, not just a zip archiver program. On Android, you can use APK Editor Pro, for example.
Click to expand...
Click to collapse
It was my impression that the APK files were zip files with a particular signature block. I shall try a tool like APK Editor Pro and report back.
tremalnaik said:
have you already uninstalled Chrome? If Chrome is installed, it will be forced as the standard WebView provider.
Click to expand...
Click to collapse
I have uninstalled/removed both Chrome and the Android System WebView (Google Apps version).
Ascii3 said:
It was my impression that the APK files were zip files with a particular signature block. I shall try a tool like APK Editor Pro and report back.
Click to expand...
Click to collapse
Now I'm on PC and I remember the name of the tool I use sometimes on PC: APKChanger. It's very complete, although very heavy (about 650MB with my current configuration);
If you have platform tools installed on your pc, or the whole Android Studio, you can also use
Code:
aapt d xmltree framework-res.apk res/xml/config_webview_packages.xml
to see the list of allowed webview packages.
Ascii3 said:
I have uninstalled/removed both Chrome and the Android System WebView (Google Apps version).
Click to expand...
Click to collapse
So we can be sure the problem is not the system forcing Chrome as default WebView provider. So, as Bromite's wiki states, "Changing the package name does not make installation easier/possible;", so the only solution is to add com.android.webview to config_webview_packages.xml, or, if it is already there, remove the requirement for Google's signature on the webview package. EDIT: I checked, on your file com.android.webview is missing, you just need to add it:
Code:
E: webviewproviders (line=20)
E: webviewprovider (line=21)
A: description="Chrome Stable" (Raw: "Chrome Stable")
A: packageName="com.android.chrome" (Raw: "com.android.chrome")
A: availableByDefault=(type 0x12)0xffffffff (Raw: "true")
E: webviewprovider (line=24)
A: description="Google WebView" (Raw: "Google WebView")
A: packageName="com.google.android.webview" (Raw: "com.google.android.webview")
A: availableByDefault=(type 0x12)0xffffffff (Raw: "true")
A: isFallback=(type 0x12)0xffffffff (Raw: "true")
E: webviewprovider (line=27)
A: description="Chrome Beta" (Raw: "Chrome Beta")
A: packageName="com.chrome.beta" (Raw: "com.chrome.beta")
E: signature (line=28)
C: "MIIDwzCCAqugAwIBAgIJAOoj9MXoVhH6MA0GCSqGSIb3DQEBBQUAMHgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKDAtHb29nbGUgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDEUMBIGA1UEAwwLY2hyb21lX2JldGEwHhcNMTYwMjI5MTUxNTIzWhcNNDMwNzE3MTUxNTIzWjB4MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ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T+w8AW73Ka3cnbOuL5EgoDl8fM79WVlARY3X+wB/jGNrkiGIdRm2IZIeAodWgC2mtXMiferyYBKz2/F2bhnU6DwgCbegS8trFjEWviijWdJ+lBdobn7LRc3orZCtHl8UyvRDi7cye3sK9y3BM39k0g20F21wTNHAonnvL6zbuNgpd+UEsVxDpOeWrEdBFN7Md0CI2wnu8eA8ljJD45v0WWMEoxsIi131g5piNM="
E: webviewprovider (line=33)
A: description="Chrome Canary" (Raw: "Chrome Canary")
A: packageName="com.chrome.canary" (Raw: "com.chrome.canary")
E: signature (line=34)
C: "MIIDxzCCAq+gAwIBAgIJAML7APITsgV7MA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKDAtHb29nbGUgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDEWMBQGA1UEAwwNY2hyb21lX2NhbmFyeTAeFw0xNjAyMjkxOTA5MDdaFw00MzA3MTcxOTA5MDdaMHoxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKDAtHb29nbGUgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDEWMBQGA1UEAwwNY2hyb21lX2NhbmFyeTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANXfeAoZlr0ya1HBzIfAz/nLLjpPJeAPvuX5dueaxmiQgv2hNG22acriFuiiJI6TU0t8AIVJD5Ifbc4OOuA0zeFhdzWWGnmTRH6x27WI7bzOKnAqOvv21ZBmE9i8Vo++K13xWdTs3qVn1bn9oUONxFu0wKDzXYZhoj1Jom0RZGjXm16xuPlEuOzMcjiNBDoYuxPAXkMcK/G1gP4P4nAV8Rd/GGIjKRS/SUtcShhoAMOQhs4WIEkUrvEVRwhBDIbpM87oFbCVdBH38r0XS6F6CdhPJsKFhoEfq4c01HZqNmDpCPA8AAcCuSWqmXoTIqs7OqkWgduE2bInbWU7WMaTl+kCAwEAAaNQME4wHQYDVR0OBBYEFB/AsC4iPAqaLoNytNSx29qByI7+MB8GA1UdIwQYMBaAFB/AsC4iPAqaLoNytNSx29qByI7+MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAMb2Td3ro/+MGVnCPAbwBSOZMVLUKGqt6zr8CShW9mtFHnmy29EaWSYYAj1M4+6Vpkq85NsgBEck7rnUjV8A3Q0NKdTys1KRKJqVvQRBN6SwqQenSf/abxQCa8Z+69rh+3BkIU1HLtu5lrMDZwon5H91L5mpORn6vItd20uW132lwSDeUEW2CHslTrodoFuTUcSUlRiq/URfUH3baO1QHXkxpQwrBPKL5deJfcZnxh5MAtAGSQL7gHvayEFlDppETXdDO7vgGTH2dEK2TjKWALbGiKkxSqjRyTNt4/FOj10TqNRdUamj+ydVJgzGQ8bki4Vc6NnKm/r4asusxapkVR4="
E: webviewprovider (line=36)
A: description="Chrome Debug" (Raw: "Chrome Debug")
A: packageName="com.google.android.apps.chrome" (Raw: "com.google.android.apps.chrome")
On Android, I used APK Editor Pro 1.10.0 to modify res/xml/config_webview_packages.xml of /system/framework/framework-res.apk. A new APK with a generic signature was generated with the modification. I used the XML file editing option to select and modify the config_webview_packages.xml. The XML file editing functionality is given to be in beta and appears buggy.
I replaced the original /system/framework/framework-res.apk file with the patched one using the TWRP 3.2.3-0 file manager and attempted to boot to system. The system would start, but get stuck at the LG logo screen. I tried wiping data, and cache in recovery and booting again, but received the same result. I note that adb was available and usable after the boot process got stuck on the LG Logo screen.
My impression is that the patched framework-res.apk file is incompatible or defective. Perhaps APK Editor Pro 1.10.0 malformed the output APK (the XML editing feature appeared unfinished) or that the LG stock ROM expects framework-res.apk to have have a particular signature.
Perhaps a different APK editing tool should be tried. What could the problem be?
I have attached a ZIP archive containing the APK Editor Pro 1.10.0 modified framework-res.apk.
EDIT: Attachment has been removed; the file was defective and should not be used. Attachment is no longer necessary.
I have now patched framewor-res.apk successfully, and Bromite System WebView is working.
Did you use again APk Editor Pro or a PC tool?
The tools I used were Windows tools (and with a Java dependency in the case of Apktool) and were: Apktool 2.3.1 and WinRAR 5.6.1. I found that it is best to avoid newer versions of the tool unless trying to manipulate Android 9 Pie or newer resources.
Ascii3 said:
I have now patched framewor-res.apk successfully, and Bromite System WebView is working.
Click to expand...
Click to collapse
I know this is an old post, but how did you get it to boot?
I'm using apktool 2.5 and seems to be stuck on the boot screen as you were
burny02 said:
I know this is an old post, but how did you get it to boot?
I'm using apktool 2.5 and seems to be stuck on the boot screen as you were
Click to expand...
Click to collapse
From somewhere else it seems that you are now using Apktool 2.3.1.
After comparing my notes, my impression on what you are missing and some related notes:
The modified framework-res.apk should use the unmodified APK file's "AndroidManifest.xml" root file and META-INF directory contents. It is not sufficient for any of the content to be the same after decompiling.
Copy "AndroidManifest.xml" and META-INF directory from original framework-res.apk to modified framework-res.apk using zip program, if contents are different.
v2 APK signing scheme (which includes the APK file itself in validation), if present, would be broken, but the scheme's enforcement is not enforced on /system; v1 APK signing scheme (on APK contents ("AndroidManifest.xml" file and META-INF directory contents)) is still enforced.
I zipaligned output/modified framework-res.apk prior to transferring original "AndroidManifest.xml" file and META-INF directory contents, but I do not believe it matters for the purposes of getting a functional framework-res.apk.
EDIT: Some added things to keep in mind:
Sometimes clearing system cache and the runtimes cache is also necessary before system will boot after framework-res.apk replacement. Also make sure that the permissions of the replaced framework-res.apk file are at minimum whatever the original file permissions were. Depending on what software you use to replace the framework-res.apk file, the permissions set may be different.
I really appreciate the help, still does not work unfortunately.
Here is what I do:
adb pull framework-res.apk
apktool d framework-res.apk (tried most versions, mainly now 2.3.1)
Edit framework-res/res/xml/config-webview-packages.xml to:
Code:
<webviewproviders>
<webviewprovider description="Bromite WebView" packageName="com.android.webview" availableByDefault="true" isFallback="true" />
</webviewproviders>
Removing other dev versions with signatures etc
apktool b framework-res
zipalign -v 4 framework-res.apk framework-res-new.apk
Move META-INF and AndroidManifest.xml from the 1st original framework-res.apk > framework-res-new.apk (Have also tried moving res & resources from the new to the original...7Zip, WinRAR, CLI - Linux)
adb push framework-res-new.apk /system/framwork-res.apk
Modify permissions in TWRP > 0644
Move framework-res.apk from /system/ to /system/framework/framwork-res.apk (I read somewhere this is better than pushing directly. Neither worked)
Clear Davlik & Cache
Reboot
Hangs on boot screen
Any ideas if I am missing something important?
@burny02 - Please clarify whether the framework-res.apk you are trying to modify is for LG G5 stock ROM Android Nougat.
I note that you are using the "isFallback="true"" flag with the webviewprovider tag. The purpose of the isFallback attribute set to true (its default is false) is to specify that the WebView provider should be disabled by deault and should only become available when allow other WebView providers are disabled. Using the attribute with the true value with only a single WebView provider seems improper. I do not know if boot should fail if the attribute is present in the way that it is, but in both scenarios I would recommend its omission.
It has also been a while since I used Apktool versions and do not exactly remember the command lines. Do not take my not pointing to an issue with it as there necessarily not being an issue. One thing I would mention is that one typically first install a frameworks before decompiling and building. For the LG G5 RS988 Android Nougat, I believe installing the framework-res.apk as a framework was sufficient. You would specify on command line "apktool if framework-res.apk" and any tags you wish to explicitly specify, if any.
The moving of framework-res.apk to /system/ before /system/framework/ is oftentimes done by people to try to install a modified framework-res.apk with proper permissions and on a live system before the system crashes and reboots. Once framework-res.apk is copied to /system , but does not replace the framework-res.apk file, proper permissions can be set prior to using that file to replace the live framework-res.apk. It is still important to note that some software disregards permissions set when a file is relocated or copied, so this could be an issue if framework-res.apk is replaced with more restrictive permissions than the original framework-res.apk (less restrictive permissions should not usually be a problem for the app to be used). I particularity do not like the idea of the system crashing and prefer to make such changes offline (such as via the aid of a custom recovery).
Sorted. Got it working. Really appreciate the help, Ascii3
For anyone looking at this in the future, the isFallback back seems to stop booting, regardless of whether it is the only entry or not.
The procedure then works as above:
adb pull framework-res.apk
apktool d framework-res.apk (2.3.4 worked for me - SDK 24 Android 7.1 (LGG5))
Edit framework-res/res/xml/config-webview-packages.xml to:
Code:
<webviewproviders>
<webviewprovider description="Bromite WebView" packageName="com.android.webview" availableByDefault="true" />
</webviewproviders>
apktool b framework-res
Move META-INF and AndroidManifest.xml from the 1st original framework-res.apk > new framework-res-new.apk (Used 7Zip drag & drop)
adb push framework-res-new.apk /system/framework/framwork-res.apk
Modify permissions in TWRP > 0644
Clear Davlik & Cache
Reboot
I found the following unnecessary :
Installing framework (apktool if)
Zip-aligning
Moving to /system prior to /system/framework/ (Using TWRP, live system; it might be necessary)
burny02 said:
Sorted. Got it working. Really appreciate the help, Ascii3
Click to expand...
Click to collapse
Sure.
burny02 said:
For anyone looking at this in the future, the isFallback back seems to stop booting, regardless of whether it is the only entry or not.
Click to expand...
Click to collapse
The isFallback attribute is supposed to only be set to true for no more than one webviewprovider. Explicitly setting it to false (its default) should not be problematic (but does result in a larger config-webview-packages.xml file generated). Setting isFallback to true on the only webviewprovider item is not an intended use and apparently results in no boot.
burny02 said:
I found the following unnecessary :
Zip-aligning
Click to expand...
Click to collapse
I do not think zip-aligning apps is necessary generally . My understanding around the reason to do so is to try to optimize the packaged data to be more efficiently fetched in the manner which Android fetches the data.
@Ascii3 @burny02
Hello guys, sorry to exhume this post but I'm struggling and all other threads are maybe ten years old...
So I'm struggling to replicate what you did! I'm no expert but I can follow basic instructions.
So I do as you say, decompile framework-res.apk, modify the xml file (I just add the line). This step seems okay since I did some errors while editing the file and apktool would not recompile properly. Now this goes fine.
Then I got my freshly recompiled framework-res.apk, but 7zip on linux won't let me insert META-INF and AndroidManifest.xml. So I had to rename the extension .zip, do it, then rename in apk. Could this be an issue? It looks dirty.
Anyway, after this you didn't had to resign the apk? I read everywhere you had to, so I did. I did not zipaligned it since I used a resign tool I found on xda and I could not tell if I had to do it before or after resigning, but since you said you didn't zipalign it I thought whatever.
The problem is the following: after replacing framework-res.apk in /system/framework, the phone won't start, I get stuck on the starting screen and I could extract the following from logging:
01-24 04:15:17.470 +0000 4042 4042 I PackageManager: /system/framework/framework-res.apk changed; collecting certs
01-24 04:15:17.749 +0000 4042 4042 W PackageManager: Failed to scan /system/framework/framework-res.apk: Failed to collect certificates from /system/framework/framework-res.apk
Have you got any ideas of what I did wrong? It's my fourth soft-brick today, I'm getting a bit annoyed.
Thanks in advance
@LeSplendide did you ever get this working? Not sure if I'm having the same trouble, but I followed burny's instructions and my phone fails to boot. I checked logcat but I don't see anything relating to framework-res. I'm using magisk to overlay it because if I touch the /system partition for real, VoLTE stops working on my phone (known issue for this phone). I'm successfully overlaying stuff in /system/app and /system/priv-app so I do have overlaying generally working, though this is the first apk in the framework directory I've tried to overlay. Boy do I want to get this working. I've extensively degoogled and debloated this phone and the only glaring thing that remains is chrome handling webview.
TheShanMan said:
@LeSplendide did you ever get this working? Not sure if I'm having the same trouble, but I followed burny's instructions and my phone fails to boot. I checked logcat but I don't see anything relating to framework-res. I'm using magisk to overlay it because if I touch the /system partition for real, VoLTE stops working on my phone (known issue for this phone). I'm successfully overlaying stuff in /system/app and /system/priv-app so I do have overlaying generally working, though this is the first apk in the framework directory I've tried to overlay. Boy do I want to get this working. I've extensively degoogled and debloated this phone and the only glaring thing that remains is chrome handling webview.
Click to expand...
Click to collapse
I'm sorry I have no idea, rn Webview Implementation says I have Android System Webvew 102.0.5005 so I assume this is chrome webview? But I have no clue what I did or not but I know for sure I fixed my problem which was that Webview would crash when trying to sign in a google account on my MicroG'd LEAOS. Now this works so I guess I did make it work. All I found that could be a clue is a update.zip containing instructions and the webview in question. Iirc, the issue was that the zip needed to be signed so that twrp could flash it, so I think I just signed my zip and it worked but can"t tell for sure.

Categories

Resources