pha*_*pha 5 java android hashmap android-studio
那么伙计们,为什么我不能在我的 Android Studio 项目中使用 HashMap 替换方法呢?
private HashMap<Integer, Integer> scoreLine = new HashMap<Integer, Integer>();
scoreLine.put(0, 22;
scoreLine.put(1, 46);
scoreLine.put(2, 89);
scoreLine.replace(1, 49); // I can't use this
scoreLine.replace(1, 46, 49); // I can't use this either
Run Code Online (Sandbox Code Playgroud)
即使我可以使用 put 方法来添加项目
这是我的 gradle.build (只是代码的一部分)
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.practiceprojectweekend"
minSdkVersion 22
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,我确实将当前的 minSdkVersion 设置为 22
,并且替换方法需要最低级别 24
我确实将该 minSDK 替换为 24
但随后我无法使用我的 Android 设备运行该应用程序
有没有办法在不更改 minSdkVersion 的情况下解决这个问题?
| 归档时间: |
|
| 查看次数: |
3210 次 |
| 最近记录: |