В AndroidStudio создал проект. Вот так выглядит мой Build.Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "itgeen.com.reklamnoeagenstvo"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.mikepenz:materialdrawer:5.9.5@aar') {
transitive = true
}
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Уже пробовал и кэш чистить, и проект перестраивать, и версии менять, но каждый раз появляются ошибки. AppCompatActivtity не распознается, выдает Cannot resolve the symbol AppCompatActivity
package itgeen.com.reklamnoeagenstvo;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toolbar;
public class MainActivity extends AppCompatActivtity {
private Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
D:\Android\ReklamnoeAgenstvo\app\src\main\res\layout\activity_main.xml
Error:(2) No resource identifier found for attribute 'context' in package 'itgeen.com.reklamnoeagenstvo'
D:\Android\ReklamnoeAgenstvo\app\build\intermediates\res\merged\debug\layout\activity_main.xml
Error:(2) No resource identifier found for attribute 'context' in package 'itgeen.com.reklamnoeagenstvo'
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
Помогите пожалуйста. Заранее спасибо.
layout файл
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:minHeight="?attr/actionBarSize"
android:paddingTop="@dimen/tool_bar_top_padding"
android:transitionName="actionBar" />
</RelativeLayout>
ошибка в layout
The following classes could not be instantiated:
- android.support.v7.widget.AppCompatTextView (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout. Exception Details java.lang.NullPointerException at android.content.res.Resources_Delegate.getValue(Resources_Delegate.java:788) at android.content.res.Resources.getValue(Resources.java:1286) at android.support.v4.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:212) at android.support.v4.content.res.ResourcesCompat.getFont(ResourcesCompat.java:206) at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:119) at android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:208) at android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:152) at android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(AppCompatTextHelperV17.java:38) at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:81) at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:71) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:834) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at com.android.layoutlib.bridge.bars.CustomBar.<init>(CustomBar.java:95) at com.android.layoutlib.bridge.bars.StatusBar.<init>(StatusBar.java:67) at com.android.layoutlib.bridge.impl.Layout.createStatusBar(Layout.java:224) at com.android.layoutlib.bridge.impl.Layout.<init>(Layout.java:146) Copy stack to clipboard