Unable to run su from Android app on Android Pie

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Unable to run su from Android app on Android Pie

6,521 次查看
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 回复