Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Unable to apply changes on device: xxxxx. Error is: Socket connection timed out #1354

Closed
ValentinMolina500 opened this issue Aug 4, 2019 · 17 comments

Comments

@ValentinMolina500
Copy link

ValentinMolina500 commented Aug 4, 2019

Hello, recently I have not been able to run my app on an emulator or phone. The app will build successfully but will not install correctly. I created an issue on the NativeScript CLI as I had just updated to NativeScript 6 and I thought that that was the cause. We found out there that the issue was related to the Firebase in app messaging part of my app, which I had just added recently too. What is weird is that the it was working fine after I added in app messaging, and after I had upgrade to NS 6, but it stopped working about a few days later.

Things I have tried:

  • Deleting platforms, node_modules
  • Updating the android runtime
  • Verifying the appId in the package.json and app.gradle
  • Updating firebase plugin to latest
  • Uninstalling the app on the phone, and rerunning "tns run android"
  • Cloning the repo again from a state that worked

It's interesting to not one of my colleagues who is also working on the app cannot run it either.

Here's a link to the previous issue, where I have provided stack traces and logs.

This issue has prevented me from working on my app, so many thanks to anyone who can help me fix it!

@EddyVerbruggen
Copy link
Owner

Are the package id in package.json and app.gradle equal?

@ValentinMolina500
Copy link
Author

Here is my package.json

{
  "nativescript": {
    "id": "org.nativescript.TRIOApp",
    "tns-ios": {
      "version": "6.0.1"
    },
    "tns-android": {
      "version": "6.0.1"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": {
    "type": "git",
    "url": "<fill-your-repository-here>"
  },
  "dependencies": {
    "@nstudio/nativescript-checkbox": "^1.0.0",
    "babel-cli": "^6.26.0",
    "babel-preset-react-app": "^3.1.2",
    "font-awesome": "^4.7.0",
    "g": "^2.0.1",
    "nativescript-bottombar": "^3.0.8",
    "nativescript-calendar": "^2.1.0",
    "nativescript-checkbox": "^3.0.3",
    "nativescript-couchbase-plugin": "^0.9.1",
    "nativescript-drop-down": "^5.0.3",
    "nativescript-floatingactionbutton": "^5.1.0",
    "nativescript-image-zoom": "^3.0.3",
    "nativescript-material-icons": "^1.0.3",
    "nativescript-modal-datetimepicker": "^1.2.0",
    "nativescript-nbmaterial-calendar": "^1.0.1",
    "nativescript-ng2-fonticon": "^1.3.4",
    "nativescript-plugin-firebase": "^9.0.4",
    "nativescript-ripple": "^2.2.1",
    "nativescript-social-share": "^1.5.2",
    "nativescript-theme-core": "^2.0.5",
    "nativescript-ui-dataform": "^5.0.0",
    "nativescript-ui-listview": "^7.0.2",
    "nativescript-ui-sidedrawer": "^7.0.0",
    "tns": "^0.2.0",
    "tns-core-modules": "^6.0.4"
  },
  "devDependencies": {
    "nativescript-dev-webpack": "^1.0.1",
    "typescript": "3.4.5"
  },
  "name": "WSUTC_TRIOApp",
  "version": "1.0.0",
  "main": "webpack.config.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": ""
}

And here is the app.gradle

// Add your native dependencies here:

// Uncomment to add recyclerview-v7 dependency
//dependencies {
//	implementation 'com.android.support:recyclerview-v7:+'
//}

// If you want to add something to be applied before applying plugins' include.gradle files 
// e.g. project.ext.googlePlayServicesVersion = "15.0.1"
// create a file named before-plugins.gradle in the current directory and place it there

android {  
  defaultConfig {  
    generatedDensities = []
    multiDexEnabled true
    applicationId = "org.nativescript.TRIOApp"
  }  
  aaptOptions {  
    additionalParameters "--no-version-vectors"  
  }  
} 

The ID's are the same as far as I can see.

@ValentinMolina500
Copy link
Author

So I when removing the firebase plugin, the app runs fine.
Here it is in action.

saving

@EddyVerbruggen
Copy link
Owner

EddyVerbruggen commented Aug 6, 2019

@ValentinMolina500 Did you check adb logcat to figure out what's causing it? You may be missin gPlay services on that emulator for instance, or its storage is full, or your firebase config file is missing in app_resources/android, or, ..

@ValentinMolina500
Copy link
Author

ValentinMolina500 commented Aug 7, 2019

@EddyVerbruggen I don't think I am missing google play services, this same issue persists on a real phone too, and both their storages are not full.

Here's what log cat says.

08-01 18:22:24.161 23963 23963 I FIAM.Headless: Starting InAppMessaging runtime with Instance ID fLYy8gqC79c
08-01 18:22:24.200 23963 23963 D AndroidRuntime: Shutting down VM
08-01 18:22:24.203 23963 23963 E AndroidRuntime: FATAL EXCEPTION: main
08-01 18:22:24.203 23963 23963 E AndroidRuntime: Process: org.nativescript.TRIOApp, PID: 23963
08-01 18:22:24.203 23963 23963 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/picasso/OkHttpDownloader;
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.inappmessaging.display.internal.injection.modules.PicassoModule.providesFiamController(com.google.firebase:firebase-inappmessaging-display@@17.2.0:52)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.inappmessaging.display.internal.injection.modules.PicassoModule_ProvidesFiamControllerFactory.get(com.google.firebase:firebase-inappmessaging-display@@17.2.0:34)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.inappmessaging.display.internal.injection.modules.PicassoModule_ProvidesFiamControllerFactory.get(com.google.firebase:firebase-inappmessaging-display@@17.2.0:11)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.inappmessaging.display.internal.FiamImageLoader_Factory.get(com.google.firebase:firebase-inappmessaging-display@@17.2.0:21)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.inappmessaging.display.internal.FiamImageLoader_Factory.get(com.google.firebase:firebase-inappmessaging-display@@17.2.0:8)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay_Factory.get(com.google.firebase:firebase-inappmessaging-display@@17.2.0:62)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay_Factory.get(com.google.firebase:firebase-inappmessaging-display@@17.2.0:16)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.inappmessaging.display.internal.injection.components.DaggerAppComponent.providesFirebaseInAppMessagingUI(com.google.firebase:firebase-inappmessaging-display@@17.2.0:102)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplayRegistrar.buildFirebaseInAppMessagingUI(com.google.firebase:firebase-inappmessaging-display@@17.2.0:74)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplayRegistrar.access$lambda$0(Unknown Source:0)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplayRegistrar$$Lambda$1.create(Unknown Source:2)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.components.ComponentRuntime.lambda$new$0(com.google.firebase:firebase-common@@17.1.0:66)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(Unknown Source:4)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.components.Lazy.get(com.google.firebase:firebase-common@@17.1.0:55)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(com.google.firebase:firebase-common@@17.1.0:155)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.FirebaseApp.initializeAllApis(com.google.firebase:firebase-common@@17.1.0:565)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.1.0:310)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.1.0:273)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.1.0:257)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@17.1.0:53)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at android.content.ContentProvider.attachInfo(ContentProvider.java:2082)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at android.content.ContentProvider.attachInfo(ContentProvider.java:2056)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@17.1.0:47)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:6946)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at android.app.ActivityThread.installContentProviders(ActivityThread.java:6491)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6408)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at android.app.ActivityThread.access$1300(ActivityThread.java:220)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1852)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:107)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at android.os.Looper.loop(Looper.java:214)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7319)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:934)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.squareup.picasso.OkHttpDownloader" on path: DexPathList[[zip file "/data/app/org.nativescript.TRIOApp-8Vhzh47G9q4SIG3rz-nt1A==/base.apk"],nativeLibraryDirectories=[/data/app/org.nativescript.TRIOApp-8Vhzh47G9q4SIG3rz-nt1A==/lib/x86, /data/app/org.nativescript.TRIOApp-8Vhzh47G9q4SIG3rz-nt1A==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
08-01 18:22:24.203 23963 23963 E AndroidRuntime: ... 37 more
08-01 18:22:24.207 1941 2311 W ActivityTaskManager: Force finishing activity org.nativescript.TRIOApp/com.tns.NativeScriptActivity
08-01 18:22:24.209 1941 24750 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
08-01 18:22:24.213 23963 23963 I Process : Sending signal. PID: 23963 SIG: 9
08-01 18:22:24.222 1941 1974 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
08-01 18:22:24.222 1941 1974 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver

And here are the files in my App_Resources/Android, I don't see a firebase config file...
image

@EddyVerbruggen
Copy link
Owner

Looks like inappmessaging requires this missing library: 08-01 18:22:24.203 23963 23963 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/picasso/OkHttpDownloader;

Can you share that repo? It may be a combination of plugins and/or firebase settings.

@Lavhe
Copy link

Lavhe commented Aug 7, 2019

I also have the same problem by the way

I have tried all possible fixes that @ValentinMolina500 tried, and none is working

@ValentinMolina500
Copy link
Author

@EddyVerbruggen

Sorry for the late reply. Here is the repo: https://github.com/ValentinMolina500/TRIOCopy

Thanks for the help!

@ValentinMolina500
Copy link
Author

@EddyVerbruggen

Any progress on a solution? I have been unable to work on my app for over a week and a half now because of this annoying bug. Thanks for the help though.

@EddyVerbruggen
Copy link
Owner

EddyVerbruggen commented Aug 18, 2019

@ValentinMolina500 that dependency I mentioned is dragged in by the In App Messaging feature. If you don't need that, you should remove it from firebase.nativescript.json and you should be good to go (after a clean build).

Background: The picasso dependency (which drags in okhttp) of In App Messaging has build errors that seem to require a bump of all Firebase Android SDKs. I'll do that soon: https://stackoverflow.com/questions/51933538/unable-to-use-firebase-in-app-messaging-in-android

Also, I think one of your other plugins may be using a different version of picasso, resulting in this issue.

Related issue, in the Firebase Android SDK repo: firebase/firebase-android-sdk#265

@EddyVerbruggen
Copy link
Owner

The related issue I mentioned above has been fixed by Google, and plugin version 9.1.0 uses their updated dependency, so it should be fine now.

@mbengchan
Copy link

@EddyVerbruggen please i need your help. I have upgraded the plugin to 9.1.0 and i am still have the issue. Here is my package.json file

{
"name": "testApp",
"version": "1.0.0",
"description": "Nativescript music app",
"author": "Mbiarrambang Alain [email protected]",
"license": "MIT",
"nativescript": {
"id": "com.nativescript.TestApp",
"templateVersion": "v2",
"tns-ios": {
"version": "6.1.0"
},
"tns-android": {
"version": "6.1.0"
}
},
"dependencies": {
"@vue/devtools": "^5.0.6",
"axios": "^0.19.0",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"nativescript-fonticon": "^2.0.0",
"nativescript-plugin-firebase": "^9.1.0",
"nativescript-socketio": "^3.2.1",
"nativescript-theme-core": "^1.0.6",
"nativescript-toasty": "^1.3.0",
"nativescript-ui-sidedrawer": "^7.0.0",
"nativescript-vue": "^2.0.0",
"nativescript-vue-devtools": "^1.2.0",
"net": "^1.0.2",
"numeral": "^2.0.6",
"tns-core-modules": "~6.1.0",
"vuex": "^3.0.1"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-loader": "^8.0.2",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"lazy": "1.0.11",
"nativescript-dev-webpack": "~1.2.0",
"nativescript-vue-template-compiler": "^2.0.0",
"node-sass": "^4.9.2",
"vue-loader": "^15.2.6"
}
}

But still have the error
Unable to apply changes on device: 8c5669bf. Error is: Socket connection timed out..

Please can you help? I can share the entire repo with you if possible. I really need to continue development of these project.

@EddyVerbruggen
Copy link
Owner

Share a repo on Github and ping me in the issues there with clear instructions on how to reproduce.

@mbengchan
Copy link

@EddyVerbruggen Here is my repo: https://github.com/erss400/Example

It contains the steps on how to reproduce.
Thanks for the help!

@EddyVerbruggen
Copy link
Owner

@erss400 Thanks for that repo. I'm currently focussing on releasing plugin version 10.0.0. Please give that a shot and let me know here if it helps. If not, I'll take a look.

@mbengchan
Copy link

mbengchan commented Sep 16, 2019

@EddyVerbruggen Okay. please notify me when you are releasing version 10.0.0

@mbengchan
Copy link

@EddyVerbruggen i have updated to plugin version 10.0.0 and i am still having the error. Please i need you help on fixing the bug

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

No branches or pull requests

4 participants