Skip to content

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

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

Closed
NickIliev opened this issue Oct 31, 2016 · 3 comments
Closed

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

NickIliev opened this issue Oct 31, 2016 · 3 comments
Labels
Milestone

Comments

@NickIliev
Copy link
Contributor

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

@NickIliev
Copy link
Contributor Author

Hey @vossad01

We have investigated the issue and can confirm that this case is reproduced with the steps you are describing. As a temporary workaround, you can delete the file cached.txt located in \build-tools\android-static-binding-generator before running the tests - we will post additional information once we have a solution.

@Plamen5kov
Copy link
Contributor

Plamen5kov commented Oct 31, 2016

Hi @vossad01,
There is a fix in master already, and you won't need to delete any files because, it will be done automatically. The related PR is already in master and you can try it out using @next.

You can give @next it a try, by running tns platform add android@next, and share if this solution works for you.

@adamvoss
Copy link

adamvoss commented Nov 1, 2016

After entering the erroring state described in the first post, the following commands were run. Both test runs were successful. I did not test beyond that, but it seems likely to be fixed.

tns platform remove android --path tests
tns platform add android@next --path tests
tns run android --emulator --path tests
tsc
tns run android --emulator --path tests

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

No branches or pull requests

5 participants