简体   繁体   中英

Facing an issue with process.start(); in Android Lollipop

Facing an issue with process.start(); in Android Lollipop

I am facing an issue with android lollipop background process inside a service. my code is working fine until KitKat.

i have a ProcessBuilder pBuilder and assigned a command into it, and starting the process builder by

Process proc = pBuilder.start();

int exitCode = proc.waitFor();

In lollipop the exitCode is always return "1" that menace failed.

is there any other way to do the same on android lollipop.

My code looks like :

final List<String> cmd = new LinkedList<String>();
cmd.add(mFfmpegPath);
cmd.add("-i");
cmd.add(inputPath);
cmd.add("-ss");
cmd.add(videoStartTime);        
cmd.add("-t");
cmd.add(videoDuration); 
cmd.add("-vcodec");
cmd.add("copy");
cmd.add("-acodec");
cmd.add("copy");
cmd.add(outputPath);
final ProcessBuilder pb = new ProcessBuilder(cmd);
return new ProcessRunnable(pb);  

Runnable class contain..

private final ProcessBuilder pBuilder;
public ProcessRunnable(ProcessBuilder process){
pBuilder = process;
}

Process proc = null;
proc = pBuilder.start();
int exitCode = pro.waitFor();

Thanks

Yes i have fixed the issue, This was due to my armeabi version, i have update it to armeabi-v7a and make some changes as described in below link. And worked both Android kitkat and lollipop version.

Please follow this link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM