Android Studio 3.1.1新版本 修改 compileSdkVersion sdk版本的各种错误
16lz
2021-01-23
在新版本3.0以上的Android Studio里面,有了很多的改动,大家都知道新创建一个项目,compileSdkVersion是最新版本的sdk
我的是Android Studio 3.1.1,最新的是complieSdkVesion 27
新建项目app/build.gradle
apply plugin: 'com.android.application'android { compileSdkVersion 27 defaultConfig { applicationId "com.test.destiny.myapplication" minSdkVersion 19 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }}dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.2' 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,不然会有各种的兼容问题。那么我们肯定会想到修改complieSdkVersion版本,我这里修改为22的:
会发现有一大堆的问题:
首先将build.gradle改正确:注意红色框
然后根据提示来到Manifest.xml:去掉红色框框的内容
同样红色框的也删掉:
最后运行就不会有错了
但是你会发现MainActivity继承的是AppComPatActivity,如果修改为Activity 的话 AppThem也要改一下
改为:
改为什么样式就要看需求了 这里只是做一个演示
最后 这样做我总觉得有错,如果有错的话 欢迎留言(⊙,,⊙)(⊙,,⊙)(⊙,,⊙)(⊙,,⊙)
更多相关文章
- Android 图片加水印
- Android gallery实现图片的左右循环旋转源码分享
- 通过 http post 方式上传多张图片
- android webview 加载进度和自定义404错误页面
- Android 上传图片到服务器(多文件上传)
- android zxing 解析二维码图片与生成二维码图片
- Android之glide加载图片圆角效果
- android编译错误