Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to apply changes on device: emulator-xxxx. Error is: Socket connection timed out.. #5031

Closed
thomas-alrek opened this issue Sep 24, 2019 · 17 comments

Comments

@thomas-alrek
Copy link

thomas-alrek commented Sep 24, 2019

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 6.1.2
  • Cross-platform modules: 6.1.1
  • Android Runtime: 6.1.1
  • iOS Runtime: 6.1.1
  • Plugin(s):
{
    "nativescript-bluetooth": "^1.3.1",
    "nativescript-carousel": "^6.1.0",
    "nativescript-datetimepicker": "^1.2.1",
    "nativescript-modal-datetimepicker": "^1.2.0",
    "nativescript-permissions": "^1.3.7",
    "nativescript-photoviewer": "^2.1.5",
    "nativescript-platform-css": "^1.6.8",
    "nativescript-social-share": "^1.5.2",
    "nativescript-socketio": "^3.2.1",
    "nativescript-svg": "^1.3.7",
    "nativescript-theme-core": "^1.0.4",
    "nativescript-toasty": "^1.3.0",
    "nativescript-ui-listview": "^7.0.5",
    "nativescript-urlhandler": "^1.3.0",
    "nativescript-videoplayer": "^4.2.1",
    "nativescript-vue": "^2.0.0",
    "nativescript-vue-devtools": "^1.2.0",
    "nativescript-vue-shadow": "^0.1.0",
    "nativescript-youtubeplayer": "^3.0.1"
}

Describe the bug
I am suddenly unable to run my app on Android devices. This error occurs both on a simulated device, and on physical devices.

The app is building OK, and it gets installed by ADB. I can even find it listed inside the Settings -> Apps & notificaitons -> See all xx apps menu.

However, the app icon does not appear in the launcher, and cannot be found through search.

The cli errors out like this:

Project successfully built.
The build result is located at: /Users/thomas/Development/myapp/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Installing on device emulator-5554...
Successfully installed on device with identifier 'emulator-5554'.
Unable to apply changes on device: emulator-5554. Error is: Socket connection timed out..

I have looked through related issues like #4138 #4902 #4029 but they was all resolved.
In this case, I do not have Firebase or Crashlytics, or AdMob dependencies, and my devices have plenty of spare storage.

The app ID is also correct in both package.json and in the app.gradle file.

I have also attempted to manuelly uninstall the APK through ADB.

I have attempted to perform tns platform clean android

I am stuck. The app builds and launches fine on iOS.

To Reproduce
I have not been able to find the root cause of this, and this I have no idea how to reproduce it.

Expected behavior
The app should launch.

Additional context

I have the following native library as a dependency through app.gradle:

com.estimote:proximity-sdk:1.0.3

@felixkrautschuk
Copy link

I run into the same issue.
Our app was working using tns-android 6.1.0. After running tns platform remove android and

  • tns platform add [email protected]
  • or tns platform add android@latest,
    I just see the splashscreen of the Android app and the logs:

Installing on device emulator-5554...
Successfully installed on device with identifier 'emulator-5554'.
Unable to apply changes on device: emulator-5554. Error is: Socket connection timed out..

Creating a new project using the latest android runtime 6.1.2 works as expected.

We have the following plugins installed:

    "@nstudio/nativescript-floatingactionbutton": "^1.1.0",
    "@nstudio/nativescript-loading-indicator": "^1.0.0",
    "@nstudio/nativescript-pulltorefresh": "^1.0.1",
    "@nstudio/nativescript-snackbar": "^1.0.0",
    "nativescript-globalevents": "^1.2.2",
    "nativescript-iqkeyboardmanager": "^1.5.1",
    "nativescript-pager": "^10.0.0",
    "nativescript-permissions": "^1.3.6",
    "nativescript-platform-css": "^1.6.9",
    "nativescript-plugin-firebase": "^10.0.1",
    "nativescript-toasty": "^2.0.1",
    "nativescript-ui-listview": "^7.0.5",
    "nativescript-ui-sidedrawer": "^7.0.1",
    "nativescript-worker-loader": "^0.9.5",
    "tns-core-modules": "^6.1.1"

@loonatic
Copy link

loonatic commented Oct 6, 2019

I'm also having this issue on a physical device after upgrading from 5.4 to 6.1 with 6.1.2 android version.

Deleting platforms folder and manually downgrading package.json to 6.1.0 works but doesnt seem like a solution.

@felixkrautschuk
Copy link

For me, the issue only occurs only on a Windows machine.
When building and running the Android app on a mac, everything works as expected.

@thomas-alrek @loonatic maybe you can confirm that?

@loonatic
Copy link

loonatic commented Oct 7, 2019

@felix-idf I'm on a Windows machine indeed. Don't own a Mac so can't "validate" there.

@endarova
Copy link
Contributor

endarova commented Oct 8, 2019

Hi @thomas-alrek ,
We were not able to reproduce the issue on our side and we will need some additional info to be able to investigate. Can you please execute tns run android --log trace and send us the log. Also if it is possible send us sample project to reproduce the issue.

@endarova
Copy link
Contributor

endarova commented Oct 8, 2019

Hi @felix-idf and @loonatic ,
We were able to reproduce the issue you describe with latest android runtime and nativescript-plugin-firebase on windows. We are investigating it and will update you when we have more info.

@endarova
Copy link
Contributor

Hi @felix-idf and @loonatic ,
There is a fix for the nativescript-plugin-firebase on windows issue in the next version of android runtime. Until we release it officially you can give it a try executing tns platform add android@next

@aligit
Copy link

aligit commented Dec 23, 2019

Hi,
Same problem here. When I run tns run android I get the following:

Execution failed for task ':app:processDebugResources'.
Package 'org.nativescript.default' from AndroidManifest.xml is not a valid Java package name as 'default' is a Java keyword.

Unable to apply changes on device: emulator-5554. Error is: Command ./gradlew failed with exit code 1.

@Fatme
Copy link
Contributor

Fatme commented Dec 23, 2019

Hey @aligit,

It seems the name of your application is default. Android doesn't allow building applications called default as default is a Java keyword. You need to create an application with a different name.

@aligit
Copy link

aligit commented Dec 23, 2019

Thank you so much @Fatme . WebStorm provides a default apple ID that I had to change to something else.

@gambheera
Copy link

I have the same issue.
changed the project to 6.1.0. But problem is still there.
Is there any luck?

@aligit
Copy link

aligit commented Jan 1, 2020 via email

@keithgulbro
Copy link

I'm having this issue too, any update? Currently on Mac.

  "nativescript": {
    "id": "com.nativescript.examplename",
    "tns-ios": {
      "version": "6.3.0"
    },
    "tns-android": {
      "version": "6.3.1"
    }
  },

I tried tns platform remove android -> tns platform add android -> tns run android --bundle (my project is built via Nativescript-Vue)

Current error:

Project successfully built.
The build result is located at: /Users/USERNAME/Desktop/Projects/PROJECTNAME/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Installing on device emulator-5554...
Successfully installed on device with identifier 'emulator-5554'.
Unable to apply changes on device: emulator-5554. Error is: Socket connection timed out..

@rosen-vladimirov
Copy link
Contributor

Hey @keithgulbro ,
Have you changed your application identifier in <path to project's App_Resources>/Android/app.gradle file? If yes, please ensure it is also changed in your package.json file.

@Mafick
Copy link

Mafick commented Jan 7, 2020

I had the same issue. What help by me was changing the App_Resources/Android/settings.json to the same value as in package.json

{"appId":"here.your.id","minSdkVersion":null,"targetSdkVersion":null}

{
  "nativescript": {
    "id": "here.your.id",
    "tns-android": {
      "version": "6.3.0"
    },
    "tns-ios": {
      "version": "6.3.0"
    }
  }

@fouladi1983
Copy link

fouladi1983 commented Jan 14, 2020

I'm using android emulator on my local machine, in AVD manager, i removed virtual device and add the new one and it fixed

@rosen-vladimirov
Copy link
Contributor

As the initial issue is resolved and the error is quite generic (it may be caused by different reasons), I'm closing this thread. Please open a separate one in case you encounter similar problem. Also ensure your application identifier is the same in package.json and all gradle files (preferably keep it set only in your package.json file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests