Rendering error - class could not be found: android.support.v7.internal.app.Windowdecoractionbar

Asked

Viewed 749 times

8

In my project Android Studio is giving a rendering problem in xml, giving the following error:

Rendering Problems The following classes could not be found: - android.support.v7.internal.app.Windowdecoractionbar (Fix Build Path, Create Class) Tip: Try to build the project.

And my dependency gradle is as follows:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.mikepenz:materialdrawer:4.4.8@aar') {
    transitive = true
}
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.1@aar'
compile 'com.daimajia.androidanimations:library:1.1.3@aar'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.github.shell-software:fab:1.0.5'
compile 'com.github.clans:fab:1.4.0'
compile 'me.drakeet.materialdialog:library:1.2.2'
}

My example xml that is with problem:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="br.com.ciaware.people.activities.MainActivity" >

<android.support.v7.widget.Toolbar
    android:id="@+id/tb_main"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:layout_alignParentLeft="true"
    android:background="?attr/colorPrimary"
    android:elevation="0dp"
    android:minHeight="?attr/actionBarSize"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

<br.com.ciaware.people.extras.SlidingTabLayout
    android:id="@+id/stl_tabs"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />


<android.support.v4.view.ViewPager
    android:id="@+id/vp_tabs"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1" />

 </RelativeLayout>

And in Messages appears these errors

Error:(11, 68) cvc-Elt.1: Cannot find the declaration of element 'Relativelayout'.

Error:(1, 56) s4s-Elt-schema-ns: The namespace of element 'x' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.

Error:(1, 56) s4s-Elt-invalid: Element 'x' is not a Valid element in a schema Document.

Error:(1, 56) schema_reference.4: Failed to read schema Document 'null', because 1) could not find the Document; 2) the Document could not be read; 3) the root element of the Document is not .

And on the Gradle console it’s like this:

Executing tasks: [:app:generateDebugSources, >:app:generateDebugAndroidTestSources, :app:assembleDebug]

:Configuration on demand is an incubating Feature. :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE :app:prepareDedroidSupportDesign2311Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE :app:prepareCompanyAndroidanimationsLibrary113Library UP-TO-DATE :app:prepareCompanyEasingLibrary101Library UP-TO-DATE :app:prepareGithubClansFab140Library UP-TO-DATE :app:prepareComGithubShellSoftwareFab105Library UP-TO-DATE :app:prepareComMelnykovFloatingactionbutton130Library UP-TO-DATE :app:prepareComMikepenzIconicsCore220Library UP-TO-DATE :app:prepareComMikepenzMaterialdrawer448Library UP-TO-DATE :app:prepareComMikepenzMaterialize028Library UP-TO-DATE :app:prepareMeDrakeetMaterialdialogLibrary122Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:preDebugAndroidTestBuild UP-TO-DATE :app:prepareDebugAndroidTestDependencies :app:compileDebugAndroidTestAidl UP-TO-DATE :app:processDebugAndroidTestManifest UP-TO-DATE :app:compileDebugAndroidTestRenderscript UP-TO-DATE :app:generateDebugAndroidTestBuildConfig UP-TO-DATE :app:generateDebugAndroidTestAssets UP-TO-DATE :app:mergeDebugAndroidTestAssets UP-TO-DATE :app:generateDebugAndroidTestResValues UP-TO-DATE :app:generateDebugAndroidTestResources UP-TO-DATE :app:mergeDebugAndroidTestResources UP-TO-DATE :app:processDebugAndroidTestResources UP-TO-DATE :app:generateDebugAndroidTestSources UP-TO-DATE :app:processDebugJavaRes UP-TO-DATE :app:compileDebugJavaWithJavac UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :app:compileDebugSources UP-TO-DATE :app:preDexDebug UP-TO-DATE :app:dexDebug UP-TO-DATE :app:validateDebugSigning :app:packageDebug UP-TO-DATE :app:zipalignDebug UP-TO-DATE :app:assembleDebug UP-TO-DATE

BUILD SUCCESSFUL

Total time: 1,868 secs

And Gradle is like this:

apply plugin: 'com.android.application'

android { compileSdkVersion 23 buildToolsVersion '23.0.2'

defaultConfig {
    applicationId "br.com.ciaware.people"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "0.0.1"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.mikepenz:materialdrawer:4.4.8@aar') {
    transitive = true
}
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.1@aar'
compile 'com.daimajia.androidanimations:library:1.1.3@aar'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.github.shell-software:fab:1.0.5'
compile 'com.github.clans:fab:1.4.0'
compile 'me.drakeet.materialdialog:library:1.2.2'
}

xml style.:

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

<style name="TextAppearanceFinish" parent="android:TextAppearance.Holo.Medium">
    <item name="android:textColor">#fff</item>
</style>


<style name="WizardPageContainer">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">match_parent</item>
    <item name="android:orientation">vertical</item>
</style>

<style name="WizardPageTitle">
    <item name="android:id">@android:id/title</item>
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_marginBottom">8dp</item>
    <item name="android:layout_marginLeft">16dp</item>
    <item name="android:layout_marginRight">16dp</item>
    <item name="android:paddingLeft">?android:attr/listPreferredItemPaddingLeft</item>
    <item name="android:textSize">36sp</item>
    <item name="android:textColor">#ff0099cc</item>
    <item name="android:fontFamily">sans-serif-thin</item>
</style>

<style name="WizardFormLabel">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_marginBottom">0dp</item>
    <item name="android:textAppearance">?android:textAppearanceSmall</item>
    <item name="android:textColor">@color/text_light</item>
    <item name="android:textStyle">bold</item>
    <item name="android:textAllCaps">true</item>
    <item name="android:paddingLeft">12dp</item>
    <item name="android:paddingRight">12dp</item>
</style>

How to fix this problem?

  • It does not render any layout or is a specific layout?

  • @Androiderson does not render any layout, all layout xml appears this message, even the layouts of Fragments, all layouts

  • Strange, this problem usually happens with custom views. Are there any components or include that you use in all layouts? If you create a new layout, just with a Textview for example, the problem persists?

  • @Androiderson Yes the problem persists, thinking it is in the schemas = xmlns:android="http://schemas.android.com/apk/res/android" , can be sera?

  • @Androiderson put more details of the bugs

  • On this last post, on Gradle, is version 23.1.0 appcompat-v7 while it was initially version 23.1.1. Which of the two is actually using?

  • Missed posting the Styles.xml, I need to know what the Theme that the app is using/descending.

  • @ramaral I will use the version that is easier and practical to solve the problem, the question is that in both the same error occurs, and I posted the style.xml and the theme is this "Theme.AppCompat.Light.Darkactionbar" and I’m also using several other themes.

  • As I said in my reply if you want to use version 23.1.1 of appcompat-v7 the Theme cannot have as Parent a Theme that use Actionbar. Change Theme.AppCompat.Light.DarkActionBar for Theme.AppCompat.Light.NoActionBar. See also the edition I made in the reply.

  • @Tiagoferezin you still have the same problem or another?

  • @Worked ramaral, put as a response

Show 6 more comments

2 answers

3


The problem is you are using the version 23.1.1 of appcompat-v7 together with Actionbar.

There are three solutions:

  • Revert to the version 23.0.1
  • Understudy Actionbar for Toolbar and make their theme descend from Theme.AppCompat.Light.NoActionBar or Theme.AppCompat.Dark.NoActionBar
  • Use the Toolbar on "form Standalone" not adding it to the Activity with setSupportActionBar(toolbar);. In this case you can use any Appcompat Theme, however you will need to fill it manually with content/actions, you need to "inflate" a menu for it:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.blah);
    
        Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
    
        // Set an OnMenuItemClickListener to handle menu item clicks
        toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                // Handle the menu item
                return true;
            }
        });
    
        // Inflate a menu to be displayed in the toolbar
        toolbar.inflateMenu(R.menu.your_toolbar_menu);
    }
    

I had the same problem when I upgraded to the version 23.1.1. Was here I found the reason and solution.

Note:
If the problem is caused by any of the third-party libraries, you need to see if there is an update that is compatible with the version 23.1.1 of appcompat-v7, if it does not exist you will have to do the downgrade for a compatible version.

  • i tried the three ways it didn’t work, it has screen that use only Toolbar and even then appears error, I put an example of a full screen.

  • And put it all there now

  • You initially referred to an error now you talk about others. Did they already exist or appeared after you tried the solutions I indicated? If you take the SlidingTabLayout errors persist?

  • I removed the Slidingtablayout and the errors persisted still, and yes they existed after I tried the solutions, this is discouraging me ja rs

  • @Tiagoferezin if I were you I would put only the necessary libraries to make this layout work with problem. You could remove the nineoldandroids library as it is no longer being updated. You also no longer need the blioteca com.melnykov:floatingactionbutton:1.3.0 because the behavior you search for with it can be achieved natively using the support library with.android.support:design:23.1.0 along with a Coordinatorlayout and a Recyclerview.

  • @Tiagoferezin Once you can run this layout without errors, you add the libraries you really need. As said above, some can be switched to native libs, others q vc are using are no longer being supported. I think that way it becomes easier to find your problem.

  • @Arubu so this is the question that this library is necessary and works normally in another project of mine, which I am developing in parallel to this.

  • In this other project Gradle has the same versions for build Tools, appcompat-v7, etc.?

  • @ramaral has build tools ta identico

  • 1

    I’m with @ramaral on this. On the line where you have <!-- Base application Theme. --> <style name="Apptheme" Parent="Theme.AppCompat.Light.Darkactionbar"> put <style name="Apptheme" Parent="Theme.AppCompat.Noactionbar"> and make sure that in your manifest in the <application> tag there is android:Theme="@style/Apptheme". Except that you will have to use a Toolbar. Follow guide http://developer.android.com/intl/pt-br/training/appbar/setting-up.html

Show 5 more comments

0

I solved the problem by changing the dependency to a more current version 'com.daimajia.slider:library:1.1.5@Aar', I have synchronized Gradle, then go to the Files menu of Android Studio and Invalidate Caches and Restart.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.