-
Notifications
You must be signed in to change notification settings - Fork 266
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
[FR] make it possible to exec from an APK similar to how we can dlopen from an APK? #1061
Comments
My experiments show that
The log above comes from an Android N device. I have also a proof that this works on Android Q x86-64 emulator. |
What would be nice in the same direction, is to make it possible to Since Android Q, the rules for The workaround is to rename ffmpeg binary to lib..ffmpeg..so and move it from assets to jniLibs. But this is not compatible with |
I suppose a way to do that would be to have the system mount the APK as a file system. That helps with using all types of assets too, not just exectuables. That's definitely not a small task, but it's an interesting idea and I can see the utility, so I'll retitle this bug to track that (since apparently I was wrong about the original problem, thanks for correcting me!), but it's going to go in the unplanned bucket and it's not going to be something we'll have the resources for any time soon. |
@DanAlbert Has there been any update on this? The ability to execute binaries without changing the filename is essential for an app I am producing at work. Our app is dependent on a third-party program that consists of numerous "independent" executables that call one another by name. While this third-party code is open source, and so we can modify this to call |
yeah, no-one is working on this, and API 30 is finished at this point too, so you're going to need a different approach. |
I'd recommend that different approach being to file a bug against studio to get the naming restriction lifted. I don't think it would be difficult to do. |
Last time I tried this, my request was rejected. |
That's disappointing that they don't care about a legitimate use case. Looks like we'll have to go the renaming route. What is the deal with the double dots (e.g. |
I did +1 it. Hopefully we can get a few more to do so. Can someone answer my question about the filenames with double dots? Does that have a special meaning to the system or is that just somebody's naming convention? |
i think that's just alex's way of implying that it doesn't actually matter what you have there. |
I invented the |
@jcgoble3 There is one additional issue to consider when you choose to keep the executable names intact: even if you succeed by crook or by hook to have your executables, it may happen that the target device will not extract them to the libs directory, because the older platforms had filtering of extracted file names of their own. This limitation seems to have been lifted at API 24 or 25, but there are still many active devices where these files must be extracted manually. |
@alexcohn Thanks for the info on the naming convention and pitfalls. Our app has a minimum API level of 28, so I don't think that will be an issue for us. |
@alexcohn That's pretty concerning and makes me think we need to be more careful in allowing this. Do you have more info? I can go digging through the packagemanager history if not. I think if it does alter our plans at all it would be to restrict (or at least warn) for contents like that when the |
@DanAlbert I looked it up again. Unfortunately, even in current master, the 'wrong' names are filtered out. I was wrong that the restriction had been lifted: actually, in Nov'2016 the change was made to allow non-lib….so files to be extracted, but only for debuggable apps. My mistake can easily be explained: I found that my debug app could work on newer devices, but because it still failed on older ones, I never pushed the change to use 'true' executable names to production. TL;NR: @jcgoble3, unfortunately, you still must rename all these executables, even if you only care about API 28+. |
Well, bleep. :P Thanks for the digging, @alexcohn. I'll get to work on renaming them and adjusting the code that calls them. |
Finally, 5.5 years later, this has been fixed! |
https://issuetracker.google.com/152645643 is still open though, so I think AGP will still make it difficult to package even if the OS will not longer ignore it? And unfortunately it's an OS change, so it'll be a while before you can rely on the behavior without a fallback :( Still, thanks @enh-google! |
Good to hear, even though I left that internship four and a half years ago and have since graduated from college and am now three years into my full-time career. I had actually forgotten about this! Hopefully it will be helpful to others. |
Not the right bug tracker, but we don't have a public buganizer component for the loader atm so filing this here for visibility.
dlopen
will automatically search the app's install directory, but I don't think it will search within the APK. Given that it would be best for app developers to move toward loading libraries directly from the APK, we should make this as painless as possible.The text was updated successfully, but these errors were encountered: