Environment
โ Component nativescript has 5.3.1 version and is up to date.
โ Component tns-core-modules has 5.3.1 version and is up to date.
โ Component tns-android has 5.3.1 version and is up to date.
"dependencies": {
"nativescript-theme-core": "^1.0.4",
"nativescript-ui-sidedrawer": "^6.0.0",
"tns-core-modules": "^5.3.1"
},
"devDependencies": {
"eslint": "^5.15.3",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-node": "^8.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"nativescript-dev-webpack": "~0.20.0"
},
Describe the bug
Carried out an update and now the my application will not run in the emulator. (although preview to a device works ok) I receive the following error.
Unable to apply changes on device: emulator-5554. Error is: Socket connection timed out..
[NSDebugAdapter] The tns command finished its execution with code 134.
The tns command finished its execution with code 134
Hi
This is repeatable. I created a basic HelloWorld app and get the same results.
(When I DOWNGRADE the app to 5.2.0 it runs ok)
โ Your ANDROID_HOME environment variable is set and points to correct directory.
โ Your adb from the Android SDK is correctly installed.
โ The Android SDK is installed.
โ A compatible Android SDK for compilation is found.
โ Javac is installed and is configured properly.
โ The Java Development Kit (JDK) is installed and is configured properly.
โ Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
โ Getting NativeScript components versions information...
โ Component nativescript has 5.3.1 version and is up to date.
โ Component tns-core-modules has 5.3.1 version and is up to date.
โ Component tns-android has 5.3.1 version and is up to date.
โ Component tns-ios has 5.3.1 version and is up to date.
Unable to apply changes on device: emulator-5554. Error is: Socket connection timed out..
Will emit event liveSyncError with data { error:
Error: Socket connection timed out.
at Timeout.setTimeout [as _onTimeout] (C:\Users\willh\AppData\Roaming\npm\node_modules\nativescript\lib\services\livesync\android-livesync-tool.js:267:46)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10),
deviceIdentifier: 'emulator-5554',
projectDir: 'C:\Users\willh\NATIVESCRIPT\HelloWorld',
applicationIdentifier: 'com.willhogarth.HelloWorld' }
Project dir from hooksArgs is: C:\Users\willh\NATIVESCRIPT\HelloWorld.
Hi @PirateWildWill,
Thank you for sending us the log file!
From the log file we noticed the following:
spawn: C:\Android\android-sdk\platform-tools\adb "-s" "emulator-5554" "shell" "am" "start" "-n" "com.willhogarth.HelloWorld/com.tns.NativeScriptActivity"
Result when throw error is false:
{ stdout:
'Starting: Intent { cmp=com.willhogarth.HelloWorld/com.tns.NativeScriptActivity }\r\n',
stderr:
'Warning: Activity not started, its current task has been brought to the front\r\n',
exitCode: 0 }
It seems like the application is already running on the device and the activity of your already running app should be bring into foreground.
We tried to reproduce the error as we brought the application into background, executed tns run android command but we didn't receive the above mentioned warning. We're not sure what might gone wrong and how to reproduce it. Most probably the application is in broken state and it is not possible to be loaded into foreground.
We suggest you to wipe user data of your emulator, restart it and try to execute the command again.
If that doesn't resolve the problem you can try to use another emulator/device in order to see if the problem is related to some specific emulator.
Hi @Fatme
Thanks for the feedback
I have tried clearing User Data of my normal emulator and I still get the same problem.
I have now created a new emulator (in Android Studio) and still get the same error.
The project will run on a physical device but not the emulators.
Any project I create at V5.2 will run but not V5.3.1
Also
I tried removing Platform Android
the run Android
and the console displayed the following error:
Project successfully built.
Installing on device emulator-5554...
Successfully installed on device with identifier 'emulator-5554'.
Restarting application on device emulator-5554...
Successfully synced application com.willhogarth.HelloWorld on device emulator-5554.
System.err: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.willhogarth.HelloWorld/com.tns.NativeScriptActivity}: java.lang.ClassNotFoundException: Didn't find class "com.tns.NativeScriptActivity" on path: DexPathList[[zip file "/data/app/com.willhogarth.HelloWorld-n_RFxHXUfOSB3E5F_1Iv5g==/base.apk"],nativeLibraryDirectories=[/data/app/com.willhogarth.HelloWorld-n_RFxHXUfOSB3E5F_1Iv5g==/lib/x86, /data/app/com.willhogarth.HelloWorld-n_RFxHXUfOSB3E5F_1Iv5g==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2679)
System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
System.err: at android.app.ActivityThread.-wrap11(Unknown Source:0)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
System.err: at android.os.Looper.loop(Looper.java:164)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6494)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.tns.NativeScriptActivity" on path: DexPathList[[zip file "/data/app/com.willhogarth.HelloWorld-n_RFxHXUfOSB3E5F_1Iv5g==/base.apk"],nativeLibraryDirectories=[/data/app/com.willhogarth.HelloWorld-n_RFxHXUfOSB3E5F_1Iv5g==/lib/x86, /data/app/com.willhogarth.HelloWorld-n_RFxHXUfOSB3E5F_1Iv5g==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
System.err: at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
System.err: ... 9 more
System.err: Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity;
System.err: at java.lang.VMClassLoader.findLoadedClass(Native Method)
System.err: at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
System.err: ... 12 more
System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.AppCompatActivity" on path: DexPathList[[zip file "/data/app/com.willhogarth.HelloWorld-n_RFxHXUfOSB3E5F_1Iv5g==/base.apk"],nativeLibraryDirectories=[/data/app/com.willhogarth.HelloWorld-n_RFxHXUfOSB3E5F_1Iv5g==/lib/x86, /data/app/com.willhogarth.HelloWorld-n_RFxHXUfOSB3E5F_1Iv5g==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
System.err: ... 15 more
My coworker and I are getting the exact same thing, except we're on 5.2.1 for the app (CLI is at 5.3.4). We've tried it on freshly created emulators and on a physical device. For testing purposes, I also tried running the following manually:
adb -s emulator-5554 shell am start -n com.myapp.name/com.tns.NativeScriptActivity
When I did that, it successfully brought the app the foreground. So it's definitely something about the way tns is doing it that's causing the problem.
Hey @interrobrian ,
Can you please execute tns run android --justlaunch --log trace > out.txt and send us the out.txt file ?
Actually, I was able to just figure it out and I think it's different than @PirateWildWill's issue. We had a discrepancy of our package name between app.gradle and package.json.
@PirateWildWill,
Let me first apologize for the so late reply!
Successfully synced application com.willhogarth.HelloWorld on device emulator-5554.
System.err: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.willhogarth.HelloWorld/com.tns.NativeScriptActivity}: java.lang.ClassNotFoundException: Didn't find class "com.tns.NativeScriptActivity" on path: DexPathList[[zip file "/data/app/com.willhogarth.HelloWorld-n_RFxHXUfOSB3E5F_1Iv5g==/base.apk"],nativeLibraryDirectories=
Most probably the reason for the above error is that something gone wrong with static binding generator. In order to investigate it, we'll need the logs from gradle build. You can provide them executing tns run android --justlaunch --log trace > out.txt and send us the out.txt file. Also, is this error happens every time when you delete platforms dir or is just a sporadic error?
From the previously attached log I noticed that your emulator is named Samsung_Galaxy_S_API_28. As I cannot see such an emulator (Samsung_Galaxy_S) in default AVD window in Android Studio, we'll need the exact steps you're executing when creating a new emulator.
Giving us as much as possible information for your environment setup and steps you're executing is essential in order to provide further help on this matter.
Hi
I've finally got this working.
I uninstalled android studio
Deleted all related files
upgraded Nativesript CLI
Installed the latest android studio
Created new emulators
created a new helloworld - and that worked
upgraded my app and now that works
:)
@PirateWildWill,
I'm so happy that your issue is resolved!