NativeScript / NativeScript/nativescript-cli
Extended Android Activity crashes unit-test-runner
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 1.1k
- Fork
- 204
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 8
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Tái hiện lỗi crash bằng ns create ns-test --ts, một Android activity được mở rộng, ns test init và ns test android. Bắt đầu bằng cách lần theo cách nativescript-unit-test-runner ghi đè webpack và phân giải activity.android.ts; công việc được hoàn tất khi các unit test chạy thành công trong trường hợp có một Android activity được mở rộng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- android, javascript, typescript
- Lĩnh vực
- cli, mobile, testing
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100