我正在为 Android 应用程序编码,代码是完全正确的。我已经设置了最小 sdk 版本 21,但是当我尝试在具有 sdk 版本 21 的 Android 中安装应用程序时,应用程序崩溃,但它在其他 sdk 大于 21 的 Android 手机中运行良好。请帮助解决该问题。
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.fyp"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
最佳答案
将您的目标 sdk 版本更改为 21,将最小 sdk 版本更改为 20 并尝试
关于java - 由于 API 问题导致应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56334320/