Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I repackage after renaming the class #125

Open
kirer opened this issue Sep 7, 2024 · 1 comment
Open

How can I repackage after renaming the class #125

kirer opened this issue Sep 7, 2024 · 1 comment

Comments

@kirer
Copy link

kirer commented Sep 7, 2024

When I rename the class and package it, it prompts that I cannot find the Application class

val apk = ApkModule.loadApkFile(logger, inFile)
val directory = DexDirectory.fromZip(apk.zipEntryMap)
directory.rename(TypeKey.parse("xxx"), TypeKey.parse("xxxxx))
val builder = ApkBuilder(apk, directory)
builder.apply()
directory.refresh()
directory.shrink()
directory.merge()
directory.refreshFull()
directory.save()
apk.writeApk(outFile)  
@REAndroid
Copy link
Owner

Because you renamed application class on dex and you didn't rename on manifest

<application android:name="com.OldClass">

To rename application class:

        AndroidManifest androidManifest = apkModule.getAndroidManifest();
        androidManifest.setApplicationClassName("com.NewClass");

Tip: If you are going to make bulk class rename use RenameTypes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants