【发布时间】:2020-02-20 17:54:03
【问题描述】:
我想在 Kotlin 中制作一个待办事项应用程序。我打开了 Android Studio。 造成这种差异的原因是什么?
Android Studio 版本:Android Studio 3.5 构建 #AI-191.8026.42.35.5791312,构建于 2019 年 8 月 9 日 JRE:1.8.0_202-release-1483-b03 amd64 JVM:OpenJDK 64 位 视窗 10
我的 Gradle 脚本:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
这是我观看的视频中的脚本:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:constraint:constraintlayout:1.1.2'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
}
【问题讨论】:
-
以上依赖是针对 androidx 的,根据 video 它使用的是 sdk 版本 27,视频必须是旧的原因。
-
为什么需要支持库?这在 API 级别 29 中已被弃用且无法使用。
AndroidX是未来。你会从AndroidX得到你需要的一切 -
link 我正在尝试做这个视频中的事情。但也有区别。我怎样才能克服这些问题?如何在视频中制作应用程序?
-
我建议你看另一个视频。本教程使用过时的代码,没有遵循最佳实践。
标签: android android-studio kotlin