IDE: Android Studio
- Create new project
- Copy .jar of appcompat to by /lib/
- Set dependencies in project settins
- Add compile "com.android.support:appcompat-v7:18.0.+" to build.gradle
Add follow code:
public class MainActivity extends 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"
如何解决?我忘记做了什么?