I'm trying to use https://github.com/yt-dlp/yt-dlp library and add it to the android studio, but I can't get it to work
What I understood from the research I did was that I would use java ProcessBuilder and give it the path of the file Before that, I wrote code to copy the lib file from the assets files to the internal storage, and then give it to the proccess builder as a command
String FILE_NAME="yt-dlp_linux_armv7l";
File outputFile;
/////////////
try {
InputStream inputStream = assetManager.open(FILE_NAME);
// Write the yt_dlp file to a local file in the application's data directory
outputFile = new File(context.getFilesDir(), FILE_NAME);
outputFile.setExecutable(true);
OutputStream outputStream = new FileOutputStream(outputFile);
byte[] buffer = new byte[2048];
int length;
while ((length = inputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, length);
}
outputStream.flush();
outputStream.close();
inputStream.close();
//important
outputFile.setExecutable(true);
}
catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
**excute command **
ist<String> command = new ArrayList<>();
command.add(**outputFile.getAbsolutePath() **);
command.add(videoUrl);
ProcessBuilder pb = new ProcessBuilder(command);
pb.redirectErrorStream(true);
try {
Process process = pb.start();
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
return line;
}
try {
process.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
return e.getMessage();
}
} catch (IOException e) {
e.printStackTrace();
return e.getMessage();
}
whatever prebuilt file type i try it doesn't work
i want to make "linux_armv7l" or "aarch64" prebuild files to work with android app