When I launch sonar desktop app in mac pro, it show 'no devices running', but I can see the logs keep printing. Besides, I find these abnormal logs:
sonar: Requesting new client certificate from Sonar
sonar: ERROR: Unable to open ifstream: /data/user/0/xxxx/files/sonar/sonarCA.crt
sonar: ERROR: Unable to open ifstream: /data/user/0/xxxx/files/sonar/device.crt
sonar: Starting certificate exchange
sonar: Requesting new client certificate from Sonar
sonar: ERROR: Unable to open ifstream: /data/user/0/xxxx/files/sonar/sonarCA.crt
sonar: ERROR: Unable to open ifstream: /data/user/0/xxxx/files/sonar/device.crt
sonar: Starting certificate exchange
@jknoxville
Hey @wqycsu , Sonar works by using adb to write two files ( sonarCA.crt and device.crt ) to your app's internal data partition after your app connects and requests them. In your case the connection is being made, so I don't think the permissions mentioned above related to the problem.
It looks like what is failing here is writing those 2 files. I know of 2 reasons this might happen:
Could you run these commands in a terminal and copy the output here?
(Replace com.your.app.package with the package name for your app (whatever you've replaced with xxxx in the original comment)
adb shell
run-as com.your.app.package
ls -la files/sonar
If that is failing for you, it would also be helpful to know what device you're using and what android version it is running.
Thanks!
Hey @jknoxville thank you for helping!
I have tested sonar on emulator Nexus 5 with API 23, but the button label is 'no device running'.
I try coomands:
adb shell
run-as com.your.app.package
ls -la files/sonar
Output is:
-rw------- u0_a62 u0_a62 1013 2018-06-18 13:04 app.csr
-rw------- u0_a62 u0_a62 1181 2018-06-19 04:46 device.crt
-rw------- u0_a62 u0_a62 1679 2018-06-18 13:04 privateKey.pem
-rw------- u0_a62 u0_a62 1144 2018-06-19 04:46 sonarCA.crt
Also when i start prebuild desktop app it shows 2 available plugins - network and inspector. Because i have added its to client in android app, like this
client.addPlugin(new InspectorSonarPlugin(getApplicationContext(), descriptorMapping));
client.addPlugin(new NetworkSonarPlugin());
BUT if i build desktop app from source, i have see 'no available plugins' . How i can fix this
same problem
@jknoxville @EngleVV Just fixed 'no device running'. Just added $ANDROID_HOME variable to
~/.bash_profile like this
export ANDROID_HOME=~/Library/Android/sdk
because method which used for fetching devices and emulators uses this command (example)
child_process.exec('$ANDROID_HOME/tools/emulator -list-avds'...)
BUT...on the prebuild app this is not working))) Only for app from src
That's right, there was a recent change that went from a hardcoded sdk location to using your $ANDROID_HOME. So if you don't have it set, you won't see any plugins.
I think the right way to deal with this is detecting when it's unset and telling the user this. In my opinion it would also be worth adding a fallback location or search path, so it "just works" in most cases anyway.
Closing this here as part of issue cleanup.
Just closing the loop here for future reference, in the latest release, we've added a settings panel, where you can configure your android SDK location, in a similar way to how android studio works.
Use that to point flipper to your ANDROID_HOME, and that should take care of it.
Most helpful comment
That's right, there was a recent change that went from a hardcoded sdk location to using your $ANDROID_HOME. So if you don't have it set, you won't see any plugins.
I think the right way to deal with this is detecting when it's unset and telling the user this. In my opinion it would also be worth adding a fallback location or search path, so it "just works" in most cases anyway.