react-native run-android : Connection timed out

Error Log

Downloading https://services.gradle.org/distributions/gradle-2.14.1-all.zip

Exception in thread "main" java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
at org.gradle.wrapper.Download.download(Download.java:44)
at org.gradle.wrapper.Install$1.call(Install.java:59)
at org.gradle.wrapper.Install$1.call(Install.java:46)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:46)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

Cause

The root cause was your computer need a proxy to download gradle-2.14.1-all.zip
And the file was not downloaded by react-native command or other shell command,
it was downloaded by java codes in your react-native application.
As android uses grandle for building project, We have to set proxy server in grandle property file.

Solution

Add the following lines in gradle.properties in the android folder
systemProp.http.proxyHost=xxx.xxx.xxx.xxx
systemProp.http.proxyPort=xxxx
systemProp.https.proxyHost=xxx.xxx.xxx.xxx
systemProp.https.proxyPort=xxxx

npm config http/https proxy

npm --proxy http://username:password@server:port install packagename
npm config set proxy http://username:password@server:port
npm config set https-proxy http://username:password@server:port
 
npm config set strict-ssl false
npm config set registry "http://registry.npmjs.org/"


npm config rm proxy
npm config rm https-proxy

show hospitality to strangers

你们务要常存弟兄相爱的心。 (希伯来书 13:1 和合本)
Keep on loving one another as brothers and sisters. (Hebrews 13:1 NIV)
不可忘记用爱心接待客旅;因为曾有接待客旅的,不知不觉就接待了天使。 (希伯来书 13:2 和合本)
Do not forget to show hospitality to strangers, for by so doing some people have shown hospitality to angels without knowing it. (Hebrews 13:2 NIV)
你们要记念被捆绑的人,好像与他们同受捆绑;也要记念遭苦害的人,想到自己也在肉身之内。 (希伯来书 13:3 和合本)
Continue to remember those in prison as if you were together with them in prison, and those who are mistreated as if you yourselves were suffering. (Hebrews 13:3 NIV)


Photo by Diego PH / Unsplash

Trust in the Lord

天怎样高过地,照样,我的道路高过你们的道路;我的意念高过你们的意念。 (以赛亚书 55:9 和合本)
"As the heavens are higher than the earth, so are my ways higher than your ways and my thoughts than your thoughts. (Isaiah 55:9 NIV)

你要专心仰赖耶和华,不可倚靠自己的聪明, (箴言 3:5 和合本)
Trust in the Lord with all your heart and lean not on your own understanding; (Proverbs 3:5 NIV)
在你一切所行的事上都要认定他,他必指引你的路。 (箴言 3:6 和合本)
in all your ways submit to him, and he will make your paths straight. (Proverbs 3:6 NIV)


Photo by Federico Respini / Unsplash

微信开放平台 创建移动应用 Android 应用签名

appsign

keystore file decide it.

In fact, it is MD5 value of the keystore file.
please refer https://errong.win/generate-keystore/ to generate the keystore file.
You can get the MD5 via
keytool -list -v -keystore webrowser.keystore
MD5: 4F:87:B6:11:A4:37:5A:29:E4:A2:F7:BD:2B:DC:CC:18
Remove all ":" and turn the string to lower case.
Application signature is :
4f87b611a4375a29e4a2f7bd2bdccc18

Generate keystore file to sign your android apk

Tool

keytool
You can get this tool after you installed jdk.

Command

C:\Program Files\Java\jdk1.8.0_121\bin>keytool.exe -genkey -alias "webrowser" -keyalg "RSA" -validity 10000 -keystore "webrowser.keystore"
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: Errong
What is the name of your organizational unit?
[Unknown]: Errong
What is the name of your organization?
[Unknown]: Errong
What is the name of your City or Locality?
[Unknown]: Nanjing
What is the name of your State or Province?
[Unknown]: JiangSu
What is the two-letter country code for this unit?
[Unknown]: CN
Is CN=Errong, OU=Errong, O=Errong, L=Nanjing, ST=JiangSu, C=CN correct?
[no]:
What is your first and last name?
[Errong]:
What is the name of your organizational unit?
[Errong]:
What is the name of your organization?
[Errong]:
What is the name of your City or Locality?
[Nanjing]:
What is the name of your State or Province?
[JiangSu]:
What is the two-letter country code for this unit?
[CN]:
Is CN=Errong, OU=Errong, O=Errong, L=Nanjing, ST=JiangSu, C=CN correct?
[no]: yes

Enter key password for
(RETURN if same as keystore password):

keystore file

C:\Program Files\Java\jdk1.8.0_121\bin>dir webrowser.keystore
Volume in drive C has no label.
Volume Serial Number is 40EA-8B0A

Directory of C:\Program Files\Java\jdk1.8.0_121\bin

12/27/2017 07:19 PM 2,230 webrowser.keystore
1 File(s) 2,230 bytes
0 Dir(s) 58,290,343,936 bytes free

list keystore file

C:\Program Files\Java\jdk1.8.0_121\bin>keytool -list -v -keystore webrowser.keystore
Enter keystore password:

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 1 entry

Alias name: webrowser
Creation date: Dec 27, 2017
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Errong, OU=Errong, O=Errong, L=Nanjing, ST=JiangSu, C=CN
Issuer: CN=Errong, OU=Errong, O=Errong, L=Nanjing, ST=JiangSu, C=CN
Serial number: 4c63eb8d
Valid from: Wed Dec 27 19:19:32 CST 2017 until: Sun May 14 19:19:32 CST 2045
Certificate fingerprints:
MD5: 4F:87:B6:11:A4:37:5A:29:E4:A2:F7:BD:2B:DC:CC:18
SHA1: 21:F8:D8:7E:39:8E:49:C5:BE:A0:A1:8A:19:5E:3F:C0:4E:3F:05:66
SHA256: 77:31:F3:CB:D5:C1:1F:8D:1B:9E:A8:9D:5F:65:C8:64:56:48:8A:FB:32:BB:05:D2:5D:13:B0:8A:2C:92:D3:9F
Signature algorithm name: SHA256withRSA
Version: 3

Extensions:

#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 67 8A E4 45 0E 2D 10 87 44 E4 11 B2 C8 34 B1 A5 g..E.-..D....4..
0010: 62 4B FA BD bK..
]
]

We Browser

light web browser, heave social share

fixed: embedded-redis: Unable to run on macOS Sonoma

Issue you might see below error while trying to run embedded-redis for your testing on your macOS after you upgrade to Sonoma. java.la...