Skip to content

Running tsc after runing tests causes test execution to fail #2178

@NickIliev

Description

@NickIliev

From @vossad01 on October 28, 2016 21:16

Using the instructions from the development workflow, the test runs on a clean checkout of this repository

npm install
npm run setup
tsc
tns run android --emulator --path tests

However, if tsc is run after the test run and you try to run the tests again, the tests fail.

npm install
npm run setup
tsc
tns run android --emulator --path tests
tsc
tns run android --emulator --path tests

Exception given in emulator

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.nativescript.tests/com.tns.NativeScriptActivity}: java.lang.ClassNotFoundException: Didn't find class "com.tns.NativeScriptActivity" on path: DexPathList[[zip file "/data/app/org.nativescript.tests-1/base.apk"],nativeLibraryDirectories=[/data/app/org.nativescript.tests-1/lib/x86, /data/app/org.nativescript.tests-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2548)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.tns.NativeScriptActivity" on path: DexPathList[[zip file "/data/app/org.nativescript.tests-1/base.apk"],nativeLibraryDirectories=[/data/app/org.nativescript.tests-1/lib/x86, /data/app/org.nativescript.tests-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2538)
... 9 more

Running tsc multiple times before running the tests is not a problem. Running the tests multiple times without runnning tsc is not a problem. The problem only presents when running tsc after a test run then trying to run tests again. This was observed both with my system's tsc and the local one, ./node_modules/.bin/tsc.

git clean -f -x -d clean the repository such that you can start over and run tests again.

Tested against 667f33b and c46f216 on Linux Mint 18.

Copied from original issue: NativeScript/NativeScript#2982

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions