Skip to content

Passing compile sdk lower than 28 fails build with tns-android@next #4052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
endarova opened this issue Oct 24, 2018 · 4 comments
Open

Passing compile sdk lower than 28 fails build with tns-android@next #4052

endarova opened this issue Oct 24, 2018 · 4 comments

Comments

@endarova
Copy link
Contributor

CLI: 5.0.0-2018-10-16-12488 (RC)
Android Runtime: 5.0.0-2018-10-23-165909-01

The new android runtime requires sdk 28. If you build such project with tns build --compileSdk 27 the build will fail with error for missing resources. We need a check in that case and warning that you cannot build project with last android runtime with sdk lower than 28.

Steps:

  1. tns create TestApp --js
  2. tns platform add android@next
  3. tns build android --compileSdk 27

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugResources'.

Android resource linking failed
Output: D:\work\TestProjects\test3\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
D:\work\TestProjects\test3\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
D:\work\TestProjects\test3\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1153: error: resource android:attr/fontVariationSettings not found.
D:\work\TestProjects\test3\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1154: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Command: C:\Users\endarova.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\0925c6411c9bd9ae001a8948b7174069\aapt2-3.2.0-4818971-windows\aapt2.exe link -I
C:\Users\endarova\AppData\Local\Android\Sdk\platforms\android-27\android.jar --manifest\ D:\work\TestProjects\test3\platforms\android\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml-o\ D:\work\TestProjects\test3\platforms\android\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\ -R\ @d:\work\TestProjects\test3\platforms\android\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt
--auto-add-overlay\ --java\ D:\work\TestProjects\test3\platforms\android\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\ --custom-package\ org.nativescript.test3-0\apk--no-version-vectors
--output-text-symbols
D:\work\TestProjects\test3\platforms\android\app\build\intermediates\symbols\debug\R.txt
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0
Output: C:\Users\endarova.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\6a6559d0a9305ecc5ded117112c3f7db\res\values-v28\values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.
D:\work\TestProjects\test3\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.
C:\Users\endarova.gradle\caches\transforms-1\files-1.1\design-28.0.0.aar\c1e5d15a6b9134a1e23aed70d9b09c4b\res\values\values.xml:161:5-202: AAPT: error: resource android:attr/fontVariationSettings not found.
C:\Users\endarova.gradle\caches\transforms-1\files-1.1\design-28.0.0.aar\c1e5d15a6b9134a1e23aed70d9b09c4b\res\values\values.xml:161:5-202: AAPT: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Command: C:\Users\endarova.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\0925c6411c9bd9ae001a8948b7174069\aapt2-3.2.0-4818971-windows\aapt2.exe link -I
C:\Users\endarova\AppData\Local\Android\Sdk\platforms\android-27\android.jar
--manifest
D:\work\TestProjects\test3\platforms\android\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml-o\ D:\work\TestProjects\test3\platforms\android\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\ -R\ @d:\work\TestProjects\test3\platforms\android\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt--auto-add-overlay--java\ D:\work\TestProjects\test3\platforms\android\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r--custom-package org.nativescript.test3-0\apk
--no-version-vectors
--output-text-symbols
D:\work\TestProjects\test3\platforms\android\app\build\intermediates\symbols\debug\R.txt
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0

@dtopuzov
Copy link
Contributor

It is expected to fail since latest modules require sdk 28.
However we can try to better handle situation with user friendly error message.

@miroslavaivanova miroslavaivanova modified the milestones: 5.0.1, 5.0.2 Nov 8, 2018
@rosen-vladimirov
Copy link
Contributor

We can add warning when you pass --compileSdk that this will skip CLI's verification and the build may not work.

@rosen-vladimirov rosen-vladimirov removed this from the 5.0.2 milestone Nov 13, 2018
@RosilBelli
Copy link

My project is under the latest Nativescript version (5.3), but my app needs to run on android 5.1.

I'm trying to achieve that by running;
tns run android --bundle --compileSdk 22

But I'm asked to install Android SDK 28.

How can I generate a build for the version I need?
Couldn't find anything on the docs.

@dtopuzov
Copy link
Contributor

dtopuzov commented Apr 3, 2019

Hi @RosilBelli,

No need to set compileSdk in this case.
App you build with default options should work on all Android versions above 4.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants