NativeScript / NativeScript/nativescript-cli
Extended Android Activity crashes unit-test-runner
還沒有人認領這個 Issue。
- 主要語言
- JavaScript
- 星號
- 1.1k
- 分支
- 204
- 平均合併
- 1 天 9 小時
- 30 天內合併 PR
- 8
描述
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: 8.1.4
- Cross-platform modules: @nativescript/core 8.1.1
- Android Runtime: 8.1.1
Describe the bug
the nativescript-unit-test-runner is overriding webpack such that the extended activity file (activity.android.ts) is not resolved causing
a crash:
...
System.err: Unable to instantiate activity ComponentInfo{org.nativescript.nstest/org.myApp.MainActivity}: com.tns.NativeScriptException: Failed to create JavaScript extend wrapper for class 'org/myApp/MainActivity'
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.nativescript.nstest/org.myApp.MainActivity}: com.tns.NativeScriptException: Failed to create JavaScript extend wrapper for class 'org/myApp/MainActivity'
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3194)
...
To Reproduce
-
create new app
ns create ns-test --ts -
extend Android activity following the instructions here: https://docs.nativescript.org/advanced-concepts.html#extending-android-activity
-
verify that the app runs as expected
ns run android(the app runs without any problems) -
initialize tests
ns test initand selectjasmine -
run tests
ns test android -
crash and burn
Expected behavior
That unit tests run, even in the presence of an extended android activity
Sample project
Can't, updating AndroidManifest is required
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
使用 ns create ns-test --ts、一個擴充的 Android activity、ns test init 和 ns test android 重現當機。首先追蹤 nativescript-unit-test-runner 如何覆寫 webpack 並解析 activity.android.ts;當存在擴充的 Android activity 時單元測試能夠成功執行,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- android, javascript, typescript
- 領域
- cli, mobile, testing
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100