Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

actionbar support v7 android

IDE: Android Studio

  1. Create new project
  2. Copy .jar of appcompat to by /lib/
  3. Set dependencies in project settins
  4. Add compile "com.android.support:appcompat-v7:18.0.+" to build.gradle
  5. 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");
    }
    

AND... Nothing. Get next error:

"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"

How to fix? What i forget to do?

like image 342
TakeThat Avatar asked Mar 23 '23 11:03

TakeThat


1 Answers

you need to install the support repository

3.Select the Android Support Library item.

Note: If you're developing with Android Studio, select and install the Android Support Repository item instead. http://developer.android.com/tools/support-library/setup.html

like image 160
Vivart Avatar answered Apr 03 '23 14:04

Vivart