I've create an AVM (Android Virtual Machine) in android studio for testing. I need it to trust a self signed SSL cert we created for a website I'm working on.
When I open the website in the chrome browser on the AVM I get the following error.
This means I can't test a JavaScript service worker I need to add.
Any suggestions on how I can get chrome on the AVM device to trust the certificate.
I found I could open chrome from my host machine's terminal with
./adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
So I thought if I added the following flag which works on chrome for mac it could work, but alas, it did not.
./adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main --ignore-certificate-errors --unsafely-treat-insecure-origin-as-secure=https://example.com.test
Related
I built flutter application for web. And able to launch the app using the below command.
flutter run -d chrome
But the above command launches my web app in chrome with http://localhost:59111.
I need to test web application in https:// not with http://
Can anyone suggest me to launch web app with https:// localhost.
You can use mkcert to mock a trusted certificate while testing locally using localhost. mkcert automatically creates and installs a local Certificate Authority (CA), and generates locally-trusted certificates.
I'm developing a Chrome packaged app (not an extension), which connects to the server over secure WebSocket. The server's certificate is self-signed, and this cannot be changed.
The problem is that on the chrome packaged app, the connection attempt fails with an ERR_INSECURE_RESPONSE error.
In the Chrome browser, there is a work-around: The browser opens a security warning page. If user chooses to continue to the website, it goes on to the remote page. However there is no such work-around in a packaged app. Instead, the connection attempt just fails.
Is there any way to code the Chrome packaged app to accept a self-signed certificate?
Found a work-around - open a browser from inside the chrome app.
This is done by using a webview HTML element (webview is the chrome app name for iframe).
Now the chrome app user can accept the security risks of using a self-signed certificate, just as the web app user does.
In Visual Studio you can go to properties->debugger, select remote debugging and enter the device's ip and port (with the remote debugging tools running on the remote device), hit deploy and press F5 (or ctrl+F5).
I would like to mimic that from a command line prompt or powershell. is there any way of doing that?
I saw lots of posts that suggest creating a package, signing it with a certificate, sideloading the app and running it on the remote device, but I would like to do that from the "master computer" without doing anything on the remote device. Has anyone found a way to do that? If not, how is automatic testing done on such apps?
I seem to be plagued by an issue that a lot of people run into, when I run my Android Emulator it fails to have any usable internet connection. If I run the emulator manually and pass "-dns-server 8.8.8.8" it works just fine.
emulator.exe -dns-server 8.8.8.8 -avd {NAME}
What I'd like to do is add this "-dns-server 8.8.8.8" as a custom argument when launching the emulator through Titanium Studio. I've figured out how to do this in Eclipse for the Android SDK, but not through Titanium Studio as the same options are not available.
Titanium appears to launch the emulator with the following arguments:
\tools\emulator.exe -avd titanium_15_HVGA -port 5560 -sdcard C:\Users\dhiggins\.titanium\titanium_15_HVGA.sdcard -logcat *:d,* -no-boot-anim -partition-size 128
On a side note, it appears that if I setup my NIC to "Obtain Automatically" rather than use a static address, the Android Emulator works just fine with the internet. I, however, require a static address on my development machine.
I would first start with diagnosing the source of the problem on the static allocation. Does your static IP have the appropriate DNS server listed? When obtain automatically, there are several parameters DHCP provides, including the DNS server list.
In any case, it is fairly simple to update the commands to start the android emulator, at least for the Windows platform. I have to think that there is something similar in the mobile SDK for Apple.
Locate the mobile SDK folder. Under Win 7 it is C:\ProgramData\Titanium\mobilesdk. Under the mobile SDK folder open \android\builder.py and locate the following (search for -avd gets you right to it):
# start the emulator
emulator_cmd = [
self.sdk.get_emulator(),
'-avd',
avd_name,
'-port',
'5560',
'-sdcard',
self.sdcard,
'-logcat',
'*:d,*',
'-no-boot-anim',
'-partition-size',
'128' # in between nexusone and droid
]
debug(' '.join(emulator_cmd))
p = subprocess.Popen(emulator_cmd)
Edit this section and add one or more lines for your custom parameter(s).
Good luck!
I am new to both the android and android development so I'm not on familiar ground here.
When I start the emulator I have no service. Therefore I have no internet connection on the emulator.
I am running Windows 7 and I generally run the emulator via eclipse.
My host machine is connected to the internet via the Local Area Network. There is no proxy.
I have tried:
Disabling all network adapters except for the Local Area Network [link]
Running the emulator from cmd line with: emulator -avd -dns-server 8.8.8.8
Reinstalling the SDK Tools 9 and Platform Tools (rev 2).
Restarting the machine! :P
Is there a setup needed to specify to simulate a 3G connection? Or could this be a Windows 7 permissions issue? Or am I doomed like these folks: link link
Ah! found the solution.. I uninstalled the entire SDK and reinstalled it to C:/Android. I deleted the C:/Users/[your-name]/.android folder and recreated an avd. Voila.. Something in there worked!
[edit]
Actually it looks like you have to keep restarting the emulator until it connects. I will often get no service so I restart a bunch of times till it works.
I found that 'Airplane Mode' was enabled by default in the standalone android emulator - this may also be the cause in the sdk version. Turning this off (by holding down the red power button until the menu came up, and then toggling the airplane mode button/section) allowed the emulator to 'find service' and connect properly through the LAN.