Reputation: 159
I'm trying to start with developing Android apps with NativeScript TS, but while starting a template app (drawer) it shows me an error just after webpack compiles:
Execution failed for task ':app:checkDebugAarMetadata'.
One or more issues found when checking AAR metadata values:
Dependency 'androidx.fragment:fragment:1.4.1' requires 'compileSdkVersion' to be set to 31 or higher.
Compilation target for module ':app' is 'android-29'
Sounds like it needs android sdk to be 31 or higher, means Android 12. I have installed Android 8.1 Oreo SDK, this is the one I have on my phone. I've read that NativeScript supports 2X versions too of the SDK, so why this error appears? I followed the instalation tutorial from the NS docs, tested my instalation with ns doctor android
command and worked fine.
Java version: OpenJDK 11.0.3
(it was required by Gradle)
Installed Android SDK versions: 25 & 27
SDK Tools: SDK Build Tools 33-rc2
, NDK
, CMake
, Android Emulator
, SDK Platform Tools
Any way to fix it, a config change maybe?
Thanks.
Upvotes: 1
Views: 706
Reputation: 159
Alright, so after few tries and a video from Youtube I solved this problem by editing app.gradle
in %PROJECT%/Android/app.gradle
and setting sdk versions to 32. There was already such code commented, so I just removed the comments, like:
// You can add your native dependencies here
dependencies {
// implementation 'androidx.multidex:multidex:2.0.1'
}
android {
compileSdkVersion 32
buildToolsVersion "32.0.0"
// ndkVersion ""
defaultConfig {
minSdkVersion 17
targetSdkVersion 32
// Version Information
versionCode 1
versionName "1.0.0"
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
It solved my problem, after running ns run android
it properly installs to my phone, even if I don't have Android 12 (api 32)!
Upvotes: 1