我刚刚创建了一个新的应用程序并添加了android平台。由于我连续几天都无法安装API 28,因此我想针对正常工作的SDK 21运行该项目。如何配置该应用程序使其与sdk 21一起运行?
我的app / App_resources / android / app.gradle是默认设置,具有:
android {
defaultConfig {
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
在platform / android / .gradle /中,我看到了4.10.2
而我的build.gradle是:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
当我运行tns时,运行android --emulator
消息是:
Gradle build...
+ setting applicationId
+ applying user-defined configuration from D:\pyworks\agrigo7\mobileapp\agrigo\app\App_Resources\Android\app.gradle
Using support library version 28.0.0
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
+ adding aar plugin dependency: D:\pyworks\agrigo7\mobileapp\agrigo\node_modules\tns-core-modules-widgets\platforms\android\widgets-release.aar
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to find Platform SDK with path: platforms;android-28
在我的Android SDK中,我尝试安装API 28,但是它不断失败。我当前的SDK如下:
已安装API 21,我尝试过:
tns run android --compileSdk 21 --emulator
它首先显示28.0.0。然后给出很多错误:
+ setting applicationId
+ applying user-defined configuration from D:\pyworks\agrigo7\mobileapp\agrigo\app\App_Resources\Android\app.gradle
**Using support library version 28.0.0**
+ adding nativescript runtime package dependency: nativescript-optimized-with-inspector
+ adding aar plugin dependency: D:\pyworks\agrigo7\mobileapp\agrigo\node_modules\tns-core-modules-widgets\platforms\android\widgets-release.aar
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
Output: error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
答案 0 :(得分:0)
我认为您对支持库和SDK版本感到困惑。它们是不同的,并且支持库的主要版本应始终与SDK的主要版本相匹配,这意味着您不能将支持库28.x与SDK 21.x一起使用。
@Jenlooper已对此breaking change at the 5.0 launch作了简要介绍,您必须在gradle文件(project.ext.supportVersion
)中指定正确的支持库版本。
此外,Google Play将所有新提交的应用程序限制为以SDK 26(Android 8.0)为目标,因此,我建议您尝试使用SDK 26而不是您无法使用的21 SDK。