How to mix 32 and 64-bit .so files in an app

Carmelo M 09/15/2017. 1 answers, 84 views
java android android linux android-ndk android-ndk ndk-build

First,I know that in an app does not allow mixed use of different architectures of the .so file(Part only uses 32, the other part only uses 64)

So,I tried to Open a new process to dynamically load 64 and 32-bit so files,but System.load()throw the error and app crashed! How to solve this problem through multiple processes? Or is there any other way to solve this?

5 Comments
Markus 07/27/2017
Welcome to SO! Please take some time to read the help pages, especially the sections named "What topics can I ask about here?" and "What types of questions should I avoid asking?". Also please take the tour and read about how to ask good questions. Lastly please learn how to create a Minimal, Complete, and Verifiable Example. Details about error would help a lot.
Alex Cohn 07/27/2017
That's a cool idea! But what kind of child process do you want to start? A service? I don't think this could work, because the system decides whether to turn on 32-bit mode based on analysis of your APK, and the JVM is setup accordingly.
Alex Cohn 07/27/2017
See stackoverflow.com/a/31879900/192373: the pm can force the ABI while installing the app.
Carmelo M 07/28/2017
@AlexCohn Thanks! I agree with you, a child process(Activity) can not solve this problem。 [stackoverflow.com/a/31879900/192373] is not working, because I want part of the function uses 32-bit .so, and part of the function uses 64-bit .so,in the same app.
Carmelo M 07/28/2017
@AlexCohn Do you have any other ideas? Master

1 Answers


Alex Cohn 07/30/2017.

Well, I did try. On the face of it, this works: use armeabi shared libs 'in the usual way', and run a arm64-v8a executable from Java with Runtime.exec() or from C with system().

You can put the executable in assets and unpack it manually, or you can cheat and rename it so that it starts with lib and ends with .so; now you can put this file in the jniLibs/armeabi directory.

The opposite way works, too: launch 32-bit executable (don't forget -fPIE) from 64-bit app.

Make sure that the library search paths do not clash.

2 comments
Carmelo M 08/04/2017
That's a cool idea!!! My project is not similar to the video transcoding background operation, but need to load the three-dimensional graphics, through the SurfaceView to interact with the user gestures. How to deal with these UI interaction is a big problem, I hope you can give me some ideas, thank you
Alex Cohn 08/04/2017
I don't think you can handle UI or perform live graphics through interprocess communication

HighResolutionMusic.com - Download Hi-Res Songs

1 (G)I-DLE

POP/STARS flac

(G)I-DLE. 2018. Writer: Riot Music Team;Harloe.
2 The Chainsmokers

Beach House flac

The Chainsmokers. 2018. Writer: Andrew Taggart.
3 Ariana Grande

​Thank U, Next flac

Ariana Grande. 2018. Writer: Crazy Mike;Scootie;Victoria Monét;Tayla Parx;TBHits;Ariana Grande.
4 Nicki Minaj

No Candle No Light flac

Nicki Minaj. 2018. Writer: Denisia “Blu June” Andrews;Kathryn Ostenberg;Brittany "Chi" Coney;Brian Lee;TJ Routon;Tushar Apte;ZAYN;Nicki Minaj.
5 Clean Bandit

Baby flac

Clean Bandit. 2018. Writer: Jack Patterson;Kamille;Jason Evigan;Matthew Knott;Marina;Luis Fonsi.
6 Imagine Dragons

Bad Liar flac

Imagine Dragons. 2018. Writer: Jorgen Odegard;Daniel Platzman;Ben McKee;Wayne Sermon;Aja Volkman;Dan Reynolds.
7 Halsey

Without Me flac

Halsey. 2018. Writer: Halsey;Delacey;Louis Bell;Amy Allen;Justin Timberlake;Timbaland;Scott Storch.
8 BTS

Waste It On Me flac

BTS. 2018. Writer: Steve Aoki;Jeff Halavacs;Ryan Ogren;Michael Gazzo;Nate Cyphert;Sean Foreman;RM.
9 BlackPink

Kiss And Make Up flac

BlackPink. 2018. Writer: Soke;Kny Factory;Billboard;Chelcee Grimes;Teddy Park;Marc Vincent;Dua Lipa.
10 Fitz And The Tantrums

HandClap flac

Fitz And The Tantrums. 2017. Writer: Fitz And The Tantrums;Eric Frederic;Sam Hollander.
11 Backstreet Boys

Chances flac

Backstreet Boys. 2018.
12 Kelly Clarkson

Never Enough flac

Kelly Clarkson. 2018. Writer: Benj Pasek;Justin Paul.
13 Diplo

Close To Me flac

Diplo. 2018. Writer: Ellie Goulding;Savan Kotecha;Peter Svensson;Ilya;Swae Lee;Diplo.
14 Anne-Marie

Rewrite The Stars flac

Anne-Marie. 2018. Writer: Benj Pasek;Justin Paul.
15 Little Mix

Woman Like Me flac

Little Mix. 2018. Writer: Nicki Minaj;Steve Mac;Ed Sheeran;Jess Glynne.
16 Imagine Dragons

Machine flac

Imagine Dragons. 2018. Writer: Wayne Sermon;Daniel Platzman;Dan Reynolds;Ben McKee;Alex Da Kid.
17 Little Mix

The Cure flac

Little Mix. 2018.
18 Bradley Cooper

Always Remember Us This Way flac

Bradley Cooper. 2018. Writer: Lady Gaga;Dave Cobb.
19 Rita Ora

Velvet Rope flac

Rita Ora. 2018.
20 Lady Gaga

I'll Never Love Again flac

Lady Gaga. 2018. Writer: Benjamin Rice;Lady Gaga.

Related questions

Hot questions

Language

Popular Tags