我为这个问题找到了 2 个解决方案,但都没有用。所以我决定问问你。
我正在使用 Debian 8 Jessie 和 Android Studio 1.4
我刚刚创建了一个新项目,当我尝试启动它时出现错误: “无法解决:com.android.support:appcompat-v7:15.+” 并给了我 3 个选项。
1) 安装 Repository 并同步项目
当我尝试它时,我得到了这样的错误:
Loading SDK information...
Ignoring unknown package filter 'extra-android-m2repository'Warning: The package filter removed all packages. There is nothing to install.
Please consider trying to update again without a package filter.
窗下:
Install failed. Please check your network connection and try again. You may continue with creating your project, but it will not complete correctly without the missing components.
2) 在文件中显示
这是我的 build.gradle 依赖项:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:15.+'
}
此行错误:
compile 'com.android.support:appcompat-v7:15.+'
3) 在项目结构对话框中显示
Dependencies 窗口被打开,再次关于这一行:
compile 'com.android.support:appcompat-v7:15.+'
尝试过的解决方案:
首先,我尝试再次下载版本sdk。我删除了 Android 4.0.3 并再次重新下载,但仍然出现同样的错误。
之后我尝试下载推荐的支持库; topic 1 , topic 2 .在我下载 Android 支持库后,rev 23.0.1 仍然有同样的错误。
之后,我尝试通过修复错误的第一个选项(安装存储库和同步项目)来解决我的问题。我又找到了一些主题。我检查了设置中的 HTTP 代理部分,已经选择了“无代理”。
因此,我尝试了所有发现的方法,但仍然出现此错误。有人可以帮助我吗?
最佳答案
使用 sdk 管理器下载最新的支持库后,您可以在 gradle 文件中设置该版本。
如果您下载了 23.0.1,请将其设置为:
compile 'com.android.support:appcompat-v7:23.0.1'
编辑: 在版本号中使用 + 时,还要注意 Android Studio 给出的以下提示:
Avoid using + in version numbers; can lead to unpredictable and unrepeatable builds (com.android.support:appcompat-v7:23.1.+)
Using + in dependencies lets you automatically pick up the latest available version rather than a specific, named version. However, this is not recommended; your builds are not repeatable; you may have tested with a slightly different version than what the build server used. (Using a dynamic version as the major version number is more problematic than using it in the minor version position.)
关于android - 无法解析 : com. android.support :appcompat-v7:15. +,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33106349/