dev7dev / v2ray-android Goto Github PK
View Code? Open in Web Editor NEWA simple Java module with sample source for implementing V2ray/Xray on Android.
A simple Java module with sample source for implementing V2ray/Xray on Android.
Hey bro. I updated the core to 1.8.7 and added support for all protocols now.
Now it supports also
Socks
ShadowSocks
Hello
Do you plan to update in the near future?
Thanks
How can I add split tunneling feature.
Hello . I used the v2ray module in my project. It is very good but I have a lot of connection problems. Sometimes the app connects but no traffic is downloaded. A little traffic is uploaded but not downloaded. In the tests, I noticed that it works only with the simple configuration tunneled from Iran, it connects in the configurations, but the error:
2024-05-15 21:01:20.270 GoLog I [Warning] [2376453221] app/proxyman/outbound: failed to process outbound traffic > proxy/vless/outbound: failed to find an available destination > common/retry: [transport/internet/grpc: failed to dial gRPC > transport/internet/grpc: Cannot dial gRPC > rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: network is unreachable"] > common/retry: all retry attempts failed
the same configuration works in another software with the same operator. if you want i can open access to my project in github on your account
Brother, I used your software to connect but the connection was not successful. I am an xray server. This is my client configuration.
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"tag": "socks",
"port": 10808,
"listen": "127.0.0.1",
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
],
"routeOnly": false
},
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": false
}
},
{
"tag": "http",
"port": 10809,
"listen": "127.0.0.1",
"protocol": "http",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
],
"routeOnly": false
},
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": false
}
}
],
"outbounds": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
},
{
"tag": "proxy",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "xxxxxxxx",
"port": xxxxxxxx,
"users": [
{
"id": "ee00332e-c219-452c-8c6d-06289fa2a3f3",
"alterId": 0,
"email": "[email protected]",
"security": "auto",
"encryption": "none",
"flow": ""
}
]
}
]
},
"streamSettings": {
"network": "tcp"
},
"mux": {
"enabled": false,
"concurrency": -1
}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
}
],
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"inboundTag": [
"api"
],
"outboundTag": "api",
"enabled": true
},
{
"type": "field",
"ip": [
"xxxxxxxx"
],
"outboundTag": "proxy",
"enabled": true
}
]
}
}
At present, my configuration can connect normally, but when I need to jump to visit some websites, or redirect to another path, it cannot be loaded. Can you help me solve it? Dude
Hello, I want to add a vmess to json class in the app, how to do it, because it is too troublesome to convert to json every time
Hi dev7 ! Recently I tried to build a v2ray android client using your module. But I'm facing some issues. When I put v2ray json config in the edit text field and connect to the server, it works fine. But when I store the json config inside of a String and use that to connect to server then then, I face no Internet problem. Let me know if you can help me to solve this issue.
I stored like this
private String v2ray_config= "{\n" +
" "dns": {\n" +
" "hosts": {\n" +
" "domain:googleapis.cn": "googleapis.com"\n" +
" },\n" +
" "servers": [\n" +
" "1.1.1.1"\n" +
" ]\n" +
" },\n" +
" "inbounds": [\n" +
" {\n" +
" "listen": "127.0.0.1",\n" +
" "port": 10808,\n" +
" "protocol": "socks",\n" +
" "settings": {\n" +
" "auth": "noauth",\n" +
" "udp": true,\n" +
" "userLevel": 8\n" +
" },\n" +
" "sniffing": {\n" +
" "destOverride": [\n" +
" "http",\n" +
" "tls"\n" +
" ],\n" +
" "enabled": true\n" +
" },\n" +
" "tag": "socks"\n" +
" },\n" +
" {\n" +
" "listen": "127.0.0.1",\n" +
" "port": 10809,\n" +
" "protocol": "http",\n" +
" "settings": {\n" +
" "userLevel": 8\n" +
" },\n" +
" "tag": "http"\n" +
" }\n" +
" ],\n" +
" "log": {\n" +
" "loglevel": "warning"\n" +
" },\n" +
" "outbounds": [\n" +
" {\n" +
" "mux": {\n" +
" "concurrency": 8,\n" +
" "enabled": false\n" +
" },\n" +
" "protocol": "vmess",\n" +
" "settings": {\n" +
" "vnext": [\n" +
" {\n" +
" "address": "sg2ray.serverip.my.id",\n" +
" "port": 443,\n" +
" "users": [\n" +
" {\n" +
" "alterId": 0,\n" +
" "encryption": "",\n" +
" "flow": "",\n" +
" "id": "7b9ee908-93d3-49fe-bb8c-0d7f5c266d6b",\n" +
" "level": 8,\n" +
" "security": "auto"\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" "streamSettings": {\n" +
" "network": "ws",\n" +
" "security": "tls",\n" +
" "tlsSettings": {\n" +
" "allowInsecure": false,\n" +
" "fingerprint": "",\n" +
" "serverName": "sg2ray.serverip.my.id",\n" +
" "show": false\n" +
" },\n" +
" "wsSettings": {\n" +
" "headers": {\n" +
" "Host": "sg2ray.serverip.my.id"\n" +
" },\n" +
" "path": "/serverssh.net"\n" +
" }\n" +
" },\n" +
" "tag": "proxy"\n" +
" },\n" +
" {\n" +
" "protocol": "freedom",\n" +
" "settings": {},\n" +
" "tag": "direct"\n" +
" },\n" +
" {\n" +
" "protocol": "blackhole",\n" +
" "settings": {\n" +
" "response": {\n" +
" "type": "http"\n" +
" }\n" +
" },\n" +
" "tag": "block"\n" +
" }\n" +
" ],\n" +
" "routing": {\n" +
" "domainStrategy": "IPIfNonMatch",\n" +
" "rules": [\n" +
" {\n" +
" "ip": [\n" +
" "1.1.1.1"\n" +
" ],\n" +
" "outboundTag": "proxy",\n" +
" "port": "53",\n" +
" "type": "field"\n" +
" }\n" +
" ]\n" +
" }\n" +
"}";
I tried to make it work using this method but it didn't work :(. Please help me to solve this. Thanks !!!
Hello am la niina aka mxbhaee the developer of NamelessnetR v2ray and NamelessnetX v2ray all bought , but have an idea of making an upgrade in design and core with additional features . But its tiresome working alone and you code is real good and would wish to work with you to make something real nice .
Hey bro sorry for again opening an issue. I thought it's really important for people who will use this module. Please mention this in the readme.md file. When we import the module in our Android Studio project then we have to set the minimum sdk to 21(It's set to 24 as default) otherwise the vpn will not work. Thank you.
I tested your codes and i faced that it require us to put objects like : inbound , outbound , setting and etc.
are they necessary?
Hi thanks for providing us with this module. i have a question how can i observe the connecting state of the service i know the v2ray service connects fast and we really cant see a connecting state but i was wondering if we can manually simulate a connecting state?
Hey bro I have added uri support in the app and it supports direct uri links such as vmess,vless,trojan .
I don't know much about github I'm new here. How can I upload the code ?
I have tried using your project, I compile everything with its libraries and perform a ping before connecting the VPN and it works very well. but after connecting the vpn and giving permission to the VPN app, there is no traffic, they performed a ping and it does not work, android 13, this using android studio 2023. Build #AI-223.8836.35.2231.10811636, built on September 14, 2023
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);
}
}
}
Hi,
Thanks for this app.
Please add the light theme to this app.
The app crashes in Andorid 14(Samsung S21 Ultra)
i have done exactly as the doc but when i use the main app it works fine but when i use the module in my own app it doesnt work
thanks for your work ๐
please add ability to support URI links , because we should convert links to jSON every time.
Hi dev7,
I hope you're doing well. I'd like to discuss the recent update. I noticed that you've added URI support to the library, but it doesn't seem to work for protocols like Shadowsocks and SOCKS (with and without username/password authentication). Additionally, the download and upload traffic and speed indicators aren't functioning.
I had implemented support for all protocols in a straightforward manner and also implemented URI support in significantly fewer lines of code than you did. However, I'm unsure why you chose to modify the code to achive it . I took inspiration from V2Ray NG to add URI support, and it works seamlessly, supporting all protocols such as Vmess, Vless, Trojan, Shadowsocks, SOCKS, and even added subnet masks.
Could you please address these issues? Should I submit a pull request or leave it as it is? Honestly, I chose to use this library because of its lightweight nature. However, with the new update, it seems to be a bit messy. Please consider resolving these issues. There are much simpler ways to handle this, buddy.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.