NativeScript / NativeScript/nativescript-cli
CLI 8.2.x does not respect the targetSdk from AndroidManifest.xml
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- JavaScript
- Estrelas
- 1.1k
- Forks
- 204
- Merge médio
- 1d 9h
- PRs com merge (30d)
- 8
Descrição
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
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Inspecione platforms/android/gradle.properties e platforms/android/app/build.gradle, com foco em computeTargetSdkVersion. Reproduza o problema com App_Resources/Android/src/main/AndroidManifest.xml e ns build android e, em seguida, verifique o relatório manifest-merger-blame ou o APK gerado. Está concluído quando uma targetSdkVersion do manifesto de 30 permanece 30 em vez de se tornar 31.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- android, javascript
- Domínio
- build-system, cli, mobile-dev
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 42/100