Android Studio中版本兼容android2.2

来源:互联网 发布:unity3d 播放网络视频 编辑:程序博客网 时间:2024/06/16 05:16

公司搞机顶盒开发,写了一个小程序,在上面运行不了,瞬间崩溃,找很多的博客,花费了很长时间也没有解决.通过QQ群找到了郭霖--郭大侠,郭大侠给小弟指点了一二,没有五分钟就解决了困惑我好久的问题,心中不胜感激,在这里记录下来:

出现的问题:

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 9 declared in library [com.android.support:appcompat-v7:24.2.1] D:\duxinwu\AndroidStudioWorkPlace\MyApplication2\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\24.2.1\AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage

因为:

dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    testCompile 'junit:junit:4.12'    compile 'com.android.support:appcompat-v7:24.2.1'}

中的

compile 'com.android.support:appcompat-v7:24.2.1'
是v7架包下的,只兼容到android2.3,所以不能过使用v7架包,把这个架包删除了:

dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    testCompile 'junit:junit:4.12'//    compile 'com.android.support:appcompat-v7:24.2.1'}

然后会出现各种问题我们一个一个解决如

:

改成

:

这时候出现以下错误,

大致意思就是找不到资源文件,找到这些资源文件下,把这些找不到的资源文件删除了就好了

还有一个是:Theme.APPCompat.Light.DarkActionBar的错误,我们找到style文件,在里面把这个主题更改成anroid:Theme.Light或者是2.2可以用的主题就可以了,

最后clean下项目就可以了

1 0