google / android-emulator-container-scripts

1.87k stars 261 forks source link

connect from my local macos adb -> to remote emulator using adb: result -> adb: device unauthorized. #292

Closed hemeda3 closed 2 years ago

hemeda3 commented 2 years ago

First thank you very much for this detailed explanation:

I am trying to connect from my local MacOs to remote emulator using my local adb:

From server side [ubuntu-m-4vcpu-32g-ram] installation done by executing: docker-compose -f js/docker/docker-compose.yaml -f js/docker/development.yaml up I verified that I can connect the emulator via webrtc (user: user1, password: passwd1, IP: https://143.198.33.249/ ) the default one I can control play with emulator I enabled developer option I was able to do : adb connect localhost:5555 ANDadb connect 143.198.33.249:5555 (143.198.33.249 is my IP) even though 143.198.33.249 is my localhost I just double check here.

From client [ MAC OS]

I tried: adb connect 143.198.33.249:5555-> i get adb: device unauthorized. I killed the adb many times I copied emulator from server to my local private + public key in the ADB_VENDOR_KEYS folder and export it same issue I pushed my local Mac Adb public key to the server, from server push it to the emualtor sudo adb push adbkey.pub /sdcard/adbkey.pub Success sudo adb push adbkey.pub /data/misc/adb/adb_keysFailed

can you please help me to connect to the emulator adb remotely if possible, why I am getting device unauthorized?

Screen Shot 2021-12-22 at 6 14 30 PM

Screen Shot 2021-12-22 at 6 14 19 PM ?

hemeda3 commented 2 years ago

when I ran adb connect 143.198.33.249 I get this error, which is constantly showing in the screen usually, but any time I ran adb connect 143.198.33.249 it trigger it immediately :

emulator_emulator | logcat: 12-22 23:53:26.026 1637 1637 E AudioFlinger: createRecord() checkRecordThread_l failed emulator_emulator | logcat: 12-22 23:53:26.026 6709 20559 E IAudioFlinger: createRecord returned error -22 emulator_emulator | logcat: 12-22 23:53:26.027 6709 20559 E AudioRecord: AudioFlinger could not create record track, status: -22 emulator_emulator | logcat: 12-22 23:53:26.027 6709 20559 E AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -22. emulator_emulator | logcat: 12-22 23:53:26.029 6709 20559 E android.media.AudioRecord: Error code -20 when initializing native AudioRecord object. emulator_emulator | logcat: 12-22 23:53:26.029 6709 20559 I MicrophoneInputStream: mic_started SR : 16000 CC : 16 SO : 6 emulator_emulator | logcat: 12-22 23:53:26.030 6709 6709 I MicroDetectionWorker: onReady emulator_emulator | logcat: 12-22 23:53:26.033 6709 20559 I MicrophoneInputStream: mic_close SR : 16000 CC : 16 SO : 6 emulator_emulator | logcat: 12-22 23:53:26.036 6709 7756 I MicroRecognitionRunner: Detection finished emulator_emulator | logcat: 12-22 23:53:26.040 6709 7756 W ErrorReporter: reportError [type: 211, code: 524300]: Error reading from input stream emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: onFatalError, processing error from engine(4) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: com.google.android.apps.gsa.shared.speech.b.g: Error reading from input stream emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at com.google.android.apps.gsa.staticplugins.microdetection.d.k.a(SourceFile:91) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at com.google.android.apps.gsa.staticplugins.microdetection.d.l.run(Unknown Source:14) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at com.google.android.libraries.gsa.runner.a.a.b(SourceFile:32) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at com.google.android.libraries.gsa.runner.a.c.call(Unknown Source:4) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at java.util.concurrent.FutureTask.run(FutureTask.java:266) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at java.util.concurrent.FutureTask.run(FutureTask.java:266) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at com.google.android.apps.gsa.shared.util.concurrent.b.g.run(Unknown Source:4) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at com.google.android.apps.gsa.shared.util.concurrent.b.aw.run(SourceFile:4) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at com.google.android.apps.gsa.shared.util.concurrent.b.aw.run(SourceFile:4) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at java.lang.Thread.run(Thread.java:764) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at com.google.android.apps.gsa.shared.util.concurrent.b.i.run(SourceFile:6) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space. emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at com.google.android.apps.gsa.speech.audio.Tee.j(SourceFile:103) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at com.google.android.apps.gsa.speech.audio.au.read(SourceFile:2) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at java.io.InputStream.read(InputStream.java:101) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at com.google.android.apps.gsa.speech.audio.ao.run(SourceFile:17) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at com.google.android.apps.gsa.speech.audio.an.run(SourceFile:2) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 W ErrorProcessor: ... 10 more emulator_emulator | logcat: 12-22 23:53:26.041 6709 7428 I MicroRecognitionRunner: Stopping hotword detection. emulator_emulator | logcat: 12-22 23:53:26.041 6709 7756 I AudioController: internalShutdown emulator_emulator | logcat: 12-22 23:53:26.046 6709 6709 I MicroDetector: Keeping mic open: false emulator_emulator | logcat: 12-22 23:53:26.046 6709 7755 I DeviceStateChecker: DeviceStateChecker cancelled emulator_emulator | logcat: 12-22 23:53:26.046 6709 6709 I MicroDetectionWorker: #onError(false) emulator_emulator | logcat: 12-22 23:53:26.112 1909 2264 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@3d4be6) emulator_emulator | logcat: 12-22 23:53:26.113 1909 1923 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@3d4be6) emulator_emulator | video: (network.cc:929): Connect failed with 99 emulator_emulator | logcat: 12-22 23:53:27.112 1909 2264 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@11d9527) emulator_emulator | logcat: 12-22 23:53:27.113 1909 1923 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@11d9527) emulator_emulator | logcat: 12-22 23:53:28.112 1909 2264 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@3493d4) emulator_emulator | logcat: 12-22 23:53:28.114 1909 1923 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@3493d4) emulator_emulator | video: (network.cc:929): Connect failed with 99 emulator_emulator | kernel: [40145.033964] healthd: battery l=100 v=5000 t=25.0 h=2 st=2 c=900 fc=300000 cc=10 chg=a emulator_emulator | kernel: [40145.424486] healthd: battery l=100 v=5000 t=25.0 h=2 st=2 c=900 fc=300000 cc=10 chg=a emulator_emulator | logcat: 12-22 23:53:29.112 1909 2264 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@565b97d) emulator_emulator | logcat: 12-22 23:53:29.114 1909 1923 I GnssLocationProvider: WakeLock released by handleMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@565b97d) emulator_emulator | logcat: 12-22 23:53:30.112 1909 2264 I GnssLocationProvider: WakeLock acquired by sendMessage(REPORT_SV_STATUS, 0, com.android.server.location.GnssLocationProvider$SvStatusInfo@e824072) emulator_emulator | logcat:

hemeda3 commented 2 years ago

docker ps

Screen Shot 2021-12-22 at 7 05 09 PM
hemeda3 commented 2 years ago

I found the solution after reading the generated launch-emulator.sh file, for any one looking for answer: I had to send my local [Macos] adb keys ~/.android/adkeys to the remote server in the same folderlocation, so that this script will pickup it and attach it while launching the emulator :

using : scp ~/.android/adbkey.pub root@254.254.254.254:/root/.android

254.254.254.254 -> is your android emulator server

Thanks for the great work Google! ❤️ .