Android开发过程中的坑及解决方法收录(五)

1. 导入依赖库出现错误

因为使用的sdk版本不同,使用下列代码强制使用最低版本,25.3.1就是我当前使用的版本号,根据自己的情况修改

configurations.all {
            resolutionStrategy.force 'com.android.support:support-annotations:25.3.1'
            resolutionStrategy.eachDependency { DependencyResolveDetails details ->
                def requested = details.requested
                if (requested.group == 'com.android.support') {
                    if (!requested.name.startsWith("multidex")) {
                        details.useVersion '25.3.1' }
                    }
                }

        }

如果想一劳永逸的话,和之前一样设置AS的模板即可
参考链接
彻底解决的方法以及修改AScompileSDKVersion

posted @ 2019-02-26 21:55  Stars-one  阅读(705)  评论(0编辑  收藏  举报