NativeScript / NativeScript/nativescript-cli
CLI 8.2.x does not respect the targetSdk from AndroidManifest.xml
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ả
Issue Description
After we upgraded to {N} 8.2.2 we found that during build, the CLI sets the targetSdk to 31 instead of respecting the value in App_Resources/Android/src/main/AndroidManifest.xml which was in our case set to 30.
The merged, final manifest in the APK has targetSdk 31
This is read from platforms/android/gradle.properties, defined as NS_DEFAULT_COMPILE_SDK_VERSION=31, applied in the platforms/android/app/build.gradle file through
def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk : NS_DEFAULT_COMPILE_SDK_VERSION as int }
Workaround: specify targetSdk in the config/android/resources/gradle.properties, e.g.
targetSdk = 30
Reproduction
in App_Resources/Android/src/main/AndroidManifest.xml set
<uses-sdk
android:minSdkVersion="26"
android:targetSdkVersion="30"/>
run ns build android
check platforms/android/app/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt or check the generated APK and it's embedded AndroidManifest.
Relevant log output (if applicable)
from `platforms/android/app/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt`
7 <uses-sdk
7-->/me/dev/test/platforms/android/app/src/main/AndroidManifest.xml:13:5-15:44
8 android:minSdkVersion="26"
8-->/me/dev/test/platforms/android/app/src/main/AndroidManifest.xml:14:13-39
9 android:targetSdkVersion="31" />
9-->/me/dev/test/platforms/android/app/src/main/AndroidManifest.xml:15:13-42
Environment
No response
Please accept these terms
- I have searched the existing issues as well as StackOverflow and this has not been posted before
- This is a bug report
- I agree to follow this project's Code of Conduct
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
Kiểm tra platforms/android/gradle.properties và platforms/android/app/build.gradle, tập trung vào computeTargetSdkVersion. Tái hiện với App_Resources/Android/src/main/AndroidManifest.xml và ns build android, sau đó kiểm tra báo cáo manifest-merger-blame hoặc APK đã tạo. Được xem là hoàn tất khi targetSdkVersion 30 trong manifest vẫn là 30 thay vì trở thành 31.
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
- Lĩnh vực
- build-system, cli, mobile-dev
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 42/100