Unable to run su from Android app on Android Pie

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

Unable to run su from Android app on Android Pie

7,925件の閲覧回数
nxpsri
Contributor II
 

I'm seeing this error :

    Caused by: android.view.InflateException: Binary XML file line #23: Binary XML file line #21: Error inflating class fragment
     Caused by: android.view.InflateException: Binary XML file line #21: Error inflating class fragment
     Caused by: java.io.IOException: Cannot run program "/system/xbin/su": error=13, Permission denied

for code:

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {

        _binding = FragmentFirstBinding.inflate(inflater, container, false)
         Runtime.getRuntime().exec("/system/xbin/su")
         Runtime.getRuntime().exec("/system/bin/ifconfig eth0 up")
        return binding.root

    }

despite providing:

    <uses-permission android:name="android.permission.ACCESS_SUPERUSER"/>
    <uses-permission android:name="android.permission.FACTORY_TEST"
AND running:

adb shell setenforce 0

What else can I try to get "su" working from within the app? I need that to disable/enable Ethernet interface. On the rooted device, I'm able to run su from the shell without any problem.

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

7,918件の閲覧回数
Zhiming_Liu
NXP TechSupport
NXP TechSupport
0 件の賞賛
返信