Genymobile / gnirehtet

Gnirehtet provides reverse tethering for Android
Apache License 2.0
6.34k stars 581 forks source link

The Android client does not start #65

Closed theprogrammer67 closed 6 years ago

theprogrammer67 commented 6 years ago

The Android client does not start. No notifications on the phone screen Android version - 6 and 7 Can I run it manually?

2017-12-06 15:35:24.367 INFO Main: Checking gnirehtet client... 2017-12-06 15:35:24.493 INFO Main: Starting relay server... 2017-12-06 15:35:24.493 INFO Main: Starting client... 2017-12-06 15:35:24.496 INFO Relay: Relay server started Broadcasting: Intent { act=com.genymobile.gnirehtet.START cmp=com.genymobile.gnirehtet/.GnirehtetControlReceiver } Broadcast completed: result=0

rom1v commented 6 years ago

What is the result of:

adb shell dumpsys package com.genymobile.gnirehtet | grep version

?

What if you adb reinstall?

theprogrammer67 commented 6 years ago
    versionCode=4 targetSdk=26
    versionName=2.1
theprogrammer67 commented 6 years ago

What if you adb reinstall?

I did not understand (

theprogrammer67 commented 6 years ago

with adb is not installed. Installed manually. Perhaps that's why it does not start?

2017-12-06 16:10:43.547 INFO Main: Installing gnirehtet client...
gnirehtet.apk: 1 file pushed. 0.5 MB/s (20616 bytes in 0.038s)
        pkg: /data/local/tmp/gnirehtet.apk
Failure [INSTALL_CANCELED_BY_USER]
rom1v commented 6 years ago

Sorry, I meant: what if you gnirehtet reinstall? :)

theprogrammer67 commented 6 years ago

Probably the Chinese are paranoid. XIAOMI: I could not turn on the USB installation https://stackoverflow.com/questions/37641670/adb-install-failure-install-canceled-by-user

theprogrammer67 commented 6 years ago

I think the reason is this

theprogrammer67 commented 6 years ago

is it possible to start the service from the phone?

rom1v commented 6 years ago

is it possible to start the service from the phone?

No.

casper commented 6 years ago

I have the same problem. I installed the APK manually by copying it over to the phone.

It seems to be installed fine. This is the output of the dumpsys command:
https://gist.github.com/casper/0a92e9a9b40458822cca855ce04f01bf

Shouldn't it be working this way too? When I run the START command the output is:

Broadcasting: Intent { act=com.genymobile.gnirehtet.START }
Broadcast completed: result=0

Does this mean it's running as it should? I still can't connect anywhere though. Any way to debug this further to try and figure out the problem?

rom1v commented 6 years ago

Does this mean it's running as it should?

It should open a dialog asking permission for VPN. Did you try this command when the screen was on?

casper commented 6 years ago

It should open a dialog asking permission for VPN. Did you try this command when the screen was on?

Yes, with screen on. It never shows the VPN dialog, and it hasn't registered itself as a VPN in the Android settings either. Using the Java version on the computer btw, if that matters.

rom1v commented 6 years ago

Are there any relevant logs in the output of adb logcat when you start gnirehtet?

casper commented 6 years ago

Seems this might be relevant:

12-30 11:06:27.170 18777 18777 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
12-30 11:06:27.176 18777 18777 D AndroidRuntime: CheckJNI is OFF
12-30 11:06:27.216 18777 18777 D ICU     : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
12-30 11:06:27.253 18777 18777 E HAL     : Dawei load: module=/system/lib64/hw/memtrack.msm8937.so
12-30 11:06:27.257 18777 18777 I Radio-JNI: register_android_hardware_Radio DONE
12-30 11:06:27.291 18777 18777 D AndroidRuntime: Calling main entry com.android.commands.am.Am
12-30 11:06:27.321  1283  1329 D com.android.server.pm.PackageManagerServiceInjector: MIUILOG- permission denied android.permission.WRITE_SECURE_SETTINGS
12-30 11:06:27.321  1283  1329 W BroadcastQueue: Permission Denial: broadcasting Intent { act=com.genymobile.gnirehtet.START flg=0x10 cmp=com.genymobile.gnirehtet/.GnirehtetControlReceiver } from null (pid=18777, uid=2000) requires android.permission.WRITE_SECURE_SETTINGS due to receiver com.genymobile.gnirehtet/.GnirehtetControlReceiver
12-30 11:06:27.323 18777 18777 D AndroidRuntime: Shutting down VM
rom1v commented 6 years ago

@casper

Permission Denial: broadcasting Intent { act=com.genymobile.gnirehtet.START flg=0x10 cmp=com.genymobile.gnirehtet/.GnirehtetControlReceiver } from null (pid=18777, uid=2000) requires android.permission.WRITE_SECURE_SETTINGS due to receiver com.genymobile.gnirehtet/.GnirehtetControlReceiver

Then see this issue.

casper commented 6 years ago

Thanks. I solved it through #40 by editing the APK file and removing the permission requirement.

I did it this way because you cannot set elevated USB permissions on any new Xiaomi MIUI phone without requesting special permissions from Xiaomi. At least I was not able to do it on my phone. Works fine now :) Thanks for your help.

rom1v commented 6 years ago

@theprogrammer67 does it also solve your problem?

theprogrammer67 commented 6 years ago

I remove the android:permission="android.permission.WRITE_SECURE_SETTINGS" line from AndroidManifest.xml file. And now everything works on XIAOMI

theprogrammer67 commented 6 years ago

Happy New Year! ))

solokiran commented 5 years ago

I have removed the said permission. here's the apk for v2.3 for XIAOMI that I am using

https://github.com/solokiran/hello-world/blob/master/gnirehtet2.apk

abhinandan2 commented 5 years ago

For others who might stumble upon here, on XIOMI phones, I had similar problem. By using logcat, I was able to find out that I need to allow the app to autostart in Security Center, and then it worked perfectly :). Thank you @rom1v :+1:

dodyirawan85 commented 5 years ago

I have removed the said permission. here's the apk for v2.3 for XIAOMI that I am using

https://github.com/solokiran/hello-world/blob/master/gnirehtet2.apk

Thank you, worked on color os 5 too

anandumdas commented 4 years ago

For Xiaomi devices you can enable USB debugging(Security settings) from developer options. It is there below the USB debugging option. No need to change the APK