dev7dev / V2ray-Android

A simple Java module with sample source for implementing V2ray/Xray on Android.
47 stars 14 forks source link

Tun2socks run error #19

Closed bobycx closed 4 months ago

bobycx commented 4 months ago

When I build your project and run, everything works fine. However when I make my own project and after following all your steps to import the v2ray module, I get this error when I call startV2ray. I didn't modify the jniLibs folder and everything is the same, this has been driving me crazy, what could possibly be the issue? Thank you so much in advance!

Tun2socks Run Error =>> java.io.IOException: Cannot run program "/data/app/~~etk1SO0qanDt4ZuBTgZ2vA==/com.example.vpn-QsQ5BKsf75TMp_-yHeZogg==/lib/x86_64/libtun2socks.so" (in directory "/data/user/0/com.example.vpn/files"): error=2, No such file or directory

my MainActivity file is very simple:


public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main);
        V2rayController.init(this, R.drawable.ic_launcher_foreground, "vpn");
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
    }

    public void toggleV2RayConnection(View view) {
        String realityConfig = "..."
        if (V2rayController.getConnectionState() == V2rayConstants.CONNECTION_STATES.DISCONNECTED) {
            V2rayController.startV2ray(this, "Test", realityConfig, null);
        } else {
            V2rayController.stopV2ray(this);
        }
    }
}