I have a really basic app, only one Activity with toolbar. Eveything works 
fine on my LG G2  (API  19) but when try to run it on tablet  Samsung 
GT-N5100( also API 19) the app crashes with an error message: Error 
inflating class android.support.v7.widget.Toolbar
I have tried cleaning my project, rebuilding it again but nothing helps. 
When i try to implent other widgets from the package ( AppCompatButton 
<https://developer.android.com/reference/android/support/v7/widget/AppCompatButton.html>)
 
it works.  I am starting to assume that device might be problem here. 
Anyway,here is my code: 

activity_main.xml
Sem zadať kód...


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="match_parent"
    android:layout_height="match_parent">

   <android.support.v7.widget.Toolbar
        android:id="@+id/my_toolbar"
        android:layout_width="match_parent"
        android:layout_height="58dp"
        android:background="?attr/colorPrimary"
        android:minHeight="?attr/actionBarSize"
        android:titleTextColor="#ffffff">
    </android.support.v7.widget.Toolbar>

</LinearLayout>


MainActivity.java

package com.example.tomas.toolbar;

import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.v7.app.AppCompatActivity;

/**
 * Created by tomas on 12.8.2016.
 */
public class MainActivity extends AppCompatActivity{

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

    }
}

   build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "com.example.tomas.toolbar"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
}



AndroidManifest.xml 

<manifest xmlns:android="http://schemas.android.com/apk/res/android";
    package="com.example.tomas.toolbar">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar">
        <activity android:name=".MainActivity" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>

            </intent-filter>
        </activity>
    </application>

</manifest>


Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/f33271fc-ad01-4b0a-8a48-838ecb6b1ced%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to