iMX8QM Android Automotive OS Root Permission Error

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

iMX8QM Android Automotive OS Root Permission Error

1,011件の閲覧回数
cbl
Contributor V

Hello,

I compiled Android Automotive OS 10 with userdebug build option for NXP iMX8QM.

I need to give root privileges by running the "su" command from within the APK that I developed with Android Studio.

public static void sudo(String... strings) {
        try {
            Process su = Runtime.getRuntime().exec("su");
            DataOutputStream outputStream = new DataOutputStream(su.getOutputStream());

            for (String s : strings) {
                outputStream.writeBytes(s + "\n");
                outputStream.flush();
            }

            outputStream.writeBytes("exit\n");
            outputStream.flush();
            try {
                su.waitFor();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            outputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

 

I am using the code block below to do this. But I get the error "W/System.err: java.io.IOException: Cannot run program "su": error=13, Permission denied".

What should I do in this situation, could you please help me this issue?

Best regards,

Efecan

 

 

 

ラベル(2)
0 件の賞賛
返信
2 返答(返信)

989件の閲覧回数
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

Looks like the problem is in the host setup for su, the password of the BSP is "root".

Regards

0 件の賞賛
返信

986件の閲覧回数
cbl
Contributor V

Hi @Bio_TICFSL,

When I run the "su" command from the console of Android Automotive OS, I become root.

I want to do this with the APK I developed, but I can't.

As I said above, when I send the "su" command from within the APK, I get a "permission denied" error in the Android Studio console.

Best regards,

Efecan

0 件の賞賛
返信