Reputation: 41
IDE: Android Studio
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?
Upvotes: 4
Views: 4909
Reputation: 1
Try importing the the library instead of copying it.
Also include:
actionBar.setDisplayShowTitleEnabled(true);
Upvotes: 0
Reputation: 15313
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
Upvotes: 7