【发布时间】:2014-03-20 05:24:02
【问题描述】:
IDE:Android Studio
- 创建新项目
- 将 appcompat 的 .jar 复制到 /lib/ 中
- 在项目设置中设置依赖项
- 将编译“com.android.support:appcompat-v7:18.0.+”添加到build.gradle
-
添加以下代码:
公共类 MainActivity 扩展 ActionBarActivity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ActionBar actionBar = getSupportActionBar(); actionBar.setTitle("hello"); }
而且...什么都没有。获取下一个错误:
"Gradle: A problem occurred configuring project ':MyApplication'.
> Failed to notify project evaluation listener. > Could not resolve all dependencies for configuration ':MyApplication:_DebugCompile'.
> Could not find any version that matches com.android.support:appcompat-v7:18.0.+.
Required by:
MyApplicationProject:MyApplication:unspecified"
如何解决?我忘了做什么?
【问题讨论】:
-
您是否下载了 Android 支持存储库?我认为您不需要 JAR。
-
我已经安装了支持库:(
-
你在项目设置中添加了库依赖吗?我的意思是,不仅在库类别中添加库。您还必须将其添加到项目依赖项中。
标签: android android-actionbar android-support-library