NativeScript / NativeScript/nativescript-cli
CLI 8.2.x does not respect the targetSdk from AndroidManifest.xml
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 1.1k
- Fork
- 204
- Merge medio
- 1g 9h
- PR unite (30g)
- 8
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Esamina platforms/android/gradle.properties e platforms/android/app/build.gradle, concentrandoti su computeTargetSdkVersion. Riproduci il problema con App_Resources/Android/src/main/AndroidManifest.xml e ns build android, quindi controlla il report manifest-merger-blame o l’APK generato. Il lavoro è completato quando una targetSdkVersion del manifest pari a 30 rimane 30 invece di diventare 31.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- android, javascript
- Ambito
- build-system, cli, mobile-dev
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 42/100