termux / termux-app

Termux - a terminal emulator application for Android OS extendible by variety of packages.
https://f-droid.org/en/packages/com.termux
Other
36.21k stars 3.81k forks source link

How to change package name without error? #2160

Closed leopedro95 closed 3 years ago

leopedro95 commented 3 years ago

Hi, I'm new to android development and I'm editing the termux script for a study. However, when I change the package name "com.termux" to anything else, it doesn't work.

Can anyone tell me what's stopping me? When compiling I don't have any error, the error I get is when I open the app on android, I get the following error: "failed to get context from package "com.termux". This can be because the app package is not installed app or has a different APK signature. Check the installation instructions at: https://github.com/termux/termux-app for more details."

I've done everything in my power, can you give me an idea how to solve it?

ghost commented 3 years ago

Application package name is not easily changeable. Every .deb file installable inside Termux is bound to application package name, so path

/data/data/com.termux/files/usr

will exist. For same reason Termux doesn't support installations for secondary device accounts.

Also before installing the modified APK you need to completely uninstall the original Termux application and add-ons Termux:API, Termux:Styling, Termux:Boot and others.

agnostic-apollo commented 3 years ago

Failed to get package context for the "com.termux" package. This may be because the app package is not installed or it has different APK signature from the current app. Check install instruction at https://github.com/termux/termux-app for more details.

That error would have been thrown when this is called and actually thrown via PackageUtils.

leopedro95 commented 3 years ago

Failed to get package context for the "com.termux" package. This may be because the app package is not installed or it has different APK signature from the current app. Check install instruction at https://github.com/termux/termux-app for more details.

That error would have been thrown when this is called and actually thrown via PackageUtils.

  • Check TermuxConstants javadocs for instructions on what changes to make in the app to change package name.
  • You also need to recompile bootstrap zip for the new package name. Check here and here.

thank you so much! I will try, thank you.

agnostic-apollo commented 3 years ago

You are welcome.