NativeScript / NativeScript/nativescript-cli

CLI 8.2.x does not respect the targetSdk from AndroidManifest.xml

Abierto
#5,664 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug-pending-triage
Lenguaje dominante
JavaScript
Estrellas
1.1k
Forks
204
Merge medio
1 d 9 h
PR fusionados (30 d)
8

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Inspecciona platforms/android/gradle.properties y platforms/android/app/build.gradle, centrándote en computeTargetSdkVersion. Reproduce el problema con App_Resources/Android/src/main/AndroidManifest.xml y ns build android, y después comprueba el informe manifest-merger-blame o el APK generado. Se considera terminado cuando una targetSdkVersion del manifiesto de 30 sigue siendo 30 en lugar de convertirse en 31.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
android, javascript
Área
build-system, cli, mobile-dev
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.