cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to run MDK app on Android emulator using MDKClient and VS Code both

aanchal_kajaria
Participant
0 Kudos

Hello,

I am trying to run my MDK app in Android Emulator on my machine by following the steps in https://developers.sap.com/tutorials/cp-mobile-dev-kit-build-client.html. Also tried in VS code, by importing the app there and then setting path Mdk: Debug App Root-pointing to the folder created in C:\MDKWorkspace\MDKCLNT01P_4-80005072\MDKClient_SDK folder after running the create-client.cmd. Both ways i get the same error in the end:

Webpack compilation complete. Watching for file changes. Webpack build done! Gradle clean... File change detected. Starting incremental webpack compilation... Downloading https://services.gradle.org/distributions/gradle-5.4.1-all.zip Webpack compilation complete. Watching for file changes. Webpack build done! Exception in thread "main" java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668) at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) 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:61) at org.gradle.wrapper.Install$1.call(Install.java:48) at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65) at org.gradle.wrapper.Install.createDist(Install.java:48) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61) Command gradlew.bat failed with exit code 1

not able to attach the complete cmd run.

Thanks in advance for quick help!

Aanchal

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

aanchal.kajaria

Can you share below details?

1. MDK SDK version >> you can find it in README md file

2. Have all the per-requisistes been installed as listed in MDK Dependency installer ?

aanchal_kajaria
Participant
0 Kudos

1. # Mobile Development Kit SDK Version: 4.1.4

2. I have installed all the prerequisites. Only change is Android SDK version and Android SDK Build-Tools is version 29 and not 28 for me(attached screenshot).

Not sure if this can be the issue.

mdkdepndenciesinstallerstatus.jpg

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

aanchal.kajaria

Were you able to resolve your issue? If so, please post an answer so others might benefit from your findings.

Regards,

Jitendra (SAP Community Moderator)

Accepted Solutions (0)

Answers (2)

Answers (2)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Can you add the following param to the tns run command in the command line:

--logtrace> tns_log.txt 2>&1

e.g.

tns run android --emulator --logtrace> tns_log.txt 2>&1

The resulting verbose log will be in the tns_log.txt, it might give more details on the error.

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

aanchal.kajaria

I would propose that you first install the required Android SDK version as per the dependency installer and then try again. Hope this solves the problem.

aanchal_kajaria
Participant
0 Kudos

Hello,

Thanks for your input. I have installed the required Android SDK and now all dependencies are resolved (screenshot attached),

Now it is taking forever to get my app ready to run on simulator. is it normal for this process to take more than 20 mins?

mdkdepndenciesinstallerstatus.jpgmdkrun.jpg

aanchal_kajaria
Participant
0 Kudos

Hello JK,

Finally I think am able to run step 4: Create the MDK Client in the link https://developers.sap.com/tutorials/cp-mobile-dev-kit-build-client.html. I am not able to see the "Application ready" message, the window closes automatically before that. Could see till "Installing plugin zip-plugin"

But my issue is still not solved. i still get the error in cmd, when running the command "tns run android --emulator"

Webpack compilation complete. Watching for file changes. Webpack build done! Gradle clean... File change detected. Starting incremental webpack compilation... Downloading https://services.gradle.org/distributions/gradle-5.4.1-all.zip Webpack compilation complete. Watching for file changes. Webpack build done! Exception in thread "main" java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668) at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) 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:61) at org.gradle.wrapper.Install$1.call(Install.java:48) at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65) at org.gradle.wrapper.Install.createDist(Install.java:48) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61) Command gradlew.bat failed with exit code 1

Please help.

Best regards

Aanchal

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

Aanchal Kajaria

I am not able to see the "Application ready" message, the window closes
 automatically before that. Could see till "Installing plugin 
zip-plugin"

looks like you double-clicked on the create-client.cmd, that's why it closes when the command completed.

Now it is taking forever to get my app ready to run on simulator. is it normal for this process to take more than 20 mins?

No, it really depends on user's machine, have seen some machine that's so slow it takes 10-15 minutes just to start up the simulator.

i still get the error in cmd, when running the command "tns run android --emulator"

Error mentioned in above comments are specific to Android mainly.

<code>Exception in thread "main" 
<a href="http://java.net/">java.net</a>.ConnectException: Connection timed out

That error looks like issue with your network.

Could you do the following:

1. Open a command prompt and run the create-client.cmd from the prompt. You can do create-client.cmd --verbose for more logs.

2. Once you see Application ready message, run/start the emulator first (Android Studio> AVD manager)
3. Run tns run android --emulator



aanchal_kajaria
Participant
0 Kudos

Hi JK,

Followed the steps you suggested, but the error remains the same. Somehow, not able to attach the Android run details file here (t says file type invalid for .txt file) and it is too many chars to paste. but final error is same:

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

Webpack compilation complete. Watching for file changes.

Webpack build done!

Exception in thread "main" java.net.ConnectException: Connection timed out: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)

at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)

at sun.net.NetworkClient.doConnect(NetworkClient.java:180)

at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)

at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)

at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)

at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)

at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)

at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1105)

at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999)

at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)

at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)

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:61)

at org.gradle.wrapper.Install$1.call(Install.java:48)

at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)

at org.gradle.wrapper.Install.createDist(Install.java:48)

at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)

at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

Command gradlew.bat failed with exit code 1

Only can attach the create client run details - CreateClientCmdRun.txt

createclientcmdrun.txt

Not sure what I can do with Android installations and settings now.

Thanks and regards

Aanchal

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

create-client.cmd seems working fine.

For the network related issue, i would suggest you to google about this, hope you will find a working solution.

ConnectException: Connection timed out: connect