When clean and build project getting error in eclipse console. And one more thing R.java in not be created it show error on R.
Error are like
W/ResourceType( 7964): Bad XML block: header size 85 or total size 5529592 is larger than data size 0.
Any help guys why this happened?
I am using these two xml
itemlist.xml
<TextView
android:id="#+id/txtNewsSource"
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:layout_margin="5dp"
android:background="#64CBD8" />
and secone one main.xml
<com.krish.horizontalscrollview.CenterLockHorizontalScrollview
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
</com.krish.horizontalscrollview.CenterLockHorizontalScrollview>
<LinearLayout
android:id="#+id/bottomLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#id/scrollView"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/btnPrev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Prev" />
<Button
android:id="#+id/btnNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Next" />
</LinearLayout>
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#id/bottomLayout"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:textColor="#FF0000"
android:padding="#dimen/padding_medium" />
First Copy "android-support-v4.jar" from your main project libs and paste it in your all external libraries.(Mean replace all android-support-v4.jar with you main one support library.)
Ensure that there is no duplication of xml data (let say:same code in your external library string file and in your main project's string file.)
Remove all external libraries, Clean+build your project.
Again include your external libraries one by one and clean.
"W/ResourceType( 8032): Bad XML block: header size 85 or total size 5529592 is larger than data size 0"
Means that you have a malformed XML resource.
You need to solve the XML error then you clean build your project.
Please validate your XML online
First Clean project from project menu
Then fix import in in your class file like this:
import com.your.package.xyz.R;
Related
I have a nice FrameLayout as main container and some other views inside it's hierarchy.
But the preview shows a simple ActionBarOverlayLayout.
What is that? Why is it here?
I have Android Studio 3.0.0
I have tried:
Restart Android Studio. Refresh the preview by resizing. Changed the preview device, changed the SDK of the preview, changed the blueprint\design options, pressed "force refresh layout" Button.
XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="8dp">
<com.makeramen.roundedimageview.RoundedImageView
android:layout_width="match_parent"
android:layout_height="#dimen/walk_list_item_height"
android:adjustViewBounds="false"
android:cropToPadding="false"
android:scaleType="centerCrop"
app:layout_heightPercent="25%"
app:layout_marginLeftPercent="0%"
app:layout_marginTopPercent="0%"
app:layout_widthPercent="100%"
app:riv_corner_radius="#dimen/corner_radius"
android:id="#+id/walk_iv" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#drawable/gradient"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingTop="16dp">
<TextView
android:id="#+id/walk_name_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_vertical"
android:padding="16dp"
android:text="New Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#fff" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="#drawable/ic_duration_icon" />
<TextView
android:id="#+id/duration_tv"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:gravity="center|left"
android:text="TextView"
android:textColor="#fff" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="#drawable/ic_marker"
android:layout_marginLeft="16dp" />
<TextView
android:id="#+id/stops_tv"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="TextView"
android:textColor="#fff" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
That is because there is a broken build in your earlier build. It is coming from the intermediate files which is because the files are not proper in your xml files. There might be a broken link or a - in the drawables names.
Until you resolve this you cannot proceed to see the layout of your app in the layout-editor.
Moreover Android Studio will not show you any error in the error log or any other terminal.
Start from the styles/themes of the app, it might contain something which is missing from the gradle or resources of the project. Due to the support library still in the project it partially showcases it as missing control of XML files, but it will not let you load the xml editor visually for the project.
You have see that by yourself, start first from drawables and then move to values folder, if not check your gradle and then come back to Java files for the error.
Had to raise
buildToolsVersion to 26.0.0
previous was bugged (25.0.2)
I faced the same problem and, In my case, it was simpler than that. I just received a warning message recommending to remove the explict reference to the BuildToolsVerison from build.gradle file so I just did it, then saved all file, Menu >> Run >> Make a project and it worked fine.
I have a project in Android and everything is okay then when i open the project yesterday this kept giving me this error
Rendering Problems
NOTE: One or more layouts are missing the layout_width or layout_height attributes. These are required in most layouts.
"invisible" in attribute "visibility" is not a valid integer (109 similar errors not shown)
Tip: Try to refresh the layout.
even when i start a new project and i go to the layout it kept giving me the error.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:background="#color/backgroundDark"
tools:context="coalesce.collabup.LoginActivity">
<!-- Login progress -->
<ProgressBar
android:id="#+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ScrollView
android:id="#+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/Logo"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:text="CollabUp"
android:textSize="70sp"
android:lineSpacingExtra="8sp"
android:typeface="normal"
android:textAlignment="center"
android:textStyle="normal|bold" />
<TextView
android:id="#+id/motto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:text="Collaboration at its finest"
android:textStyle="normal|bold"
android:textAlignment="center"
android:layout_marginTop="20dp"
android:layout_marginBottom="50dp" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true"
android:textSize="18sp"
android:padding="10dp"
android:layout_marginBottom="10dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:imeActionId="#+id/login"
android:imeActionLabel="Sign In"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<CheckBox
android:text="keep me log in?"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/checkBox2"
android:layout_marginTop="10dp" />
<Button
android:id="#+id/email_sign_in_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="16dp"
android:text="Sign In"
android:textStyle="bold"
android:layout_marginLeft="250dp"
android:layout_marginBottom="10dp"
/>
</RelativeLayout>
<TextView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="#+id/registertxt"
android:text="New to CollabUp? Create an Account now!"
android:textStyle="normal|bold"
android:textAlignment="center"
android:textSize="14sp"
android:onClick="gotoRegister"
android:layout_marginBottom="20dp" />
<TextView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="#+id/forgettxt"
android:text="Forgot your password?"
android:textStyle="normal|bold"
android:textAlignment="center"
android:onClick="gotoSendForget"
android:textSize="14sp" />
<TextView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="#+id/creditstxt"
android:text="Coalesce 2016 - All rights Reserved - CollabUp"
android:textStyle="normal|bold"
android:textColor="#android:color/white"
android:textAlignment="center"
android:textSize="14sp"
android:layout_marginTop="20dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
The issue is resolved by these changes:
Close Android Studio
Go to C:\Users\UserName.android and rename the build-cache folder to buildcache.bak
Go to C:\Users\UserName.AndroidStudio3.2\system and rename these folders
(1) caches to caches.bak
(2) compiler to compiler.bak
(3) compile-server to compile-server.bak
(4) conversion to conversion.bak
(5) external_build_system to external_build_system.bak
(6) frameworks to frameworks.bak
(7) gradle to gradle.bak
(8) resource_folder_cache to resource_folder_cache.bak
Open the Android Studio and open your project again.
This issues is caused in newer versions of android studio 3.2 you can fix the error by deleting the cache files.
step 1 : close android studio.
step 2: Go to .AndroidStudio3.2->system->caches.
step 3: Delete all files.
step 4: open Android studio
Your template is corrupted. Just go file and then setting. On the top search box, search templates and find file and code template. Choose that then choose other tab at the right hand side. click android and click layoutResourcesFile.xml.
copy and paste the below code on it and make sure you click live templates.
<?xml version="1.0" encoding="utf-8"?>
<${ROOT_TAG} xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="${LAYOUT_WIDTH}"
android:layout_height="${LAYOUT_HEIGHT}">
</${ROOT_TAG}>
I also got this error. I was helped by the following:
Remove the Android Studio files
To delete any remains of Android Studio setting files, in File Explorer, go to your user folder (%USERPROFILE%), and delete .android, .AndroidStudio and any analogous directories with versions on the end, i.e. .AndroidStudio1.2, as well as .gradle and .m2 if they exist.
The source is here
But I have not deleted these folders. I removed the dots in the folder name. After that, I launched Android Studio. She suggested that I export the settings from the old folders (in which I removed the dots in the title). I refused and re-tuned the studio. After that I opened the project and everything works.
Sorry for my english. I hope you understand my answer :)
The only thing that worked for me.
1. Download Android studio from the official website https://developer.android.com/studio/#downloads.
2. Install
You can even import settings from the previos install.
Now the render is fixed
I used the simple feature of Clean Project (Build -> Clean Project) and it somehow worked for me!
I am taking the first step into android programming and XML. I am using the Big Nerd Ranch Guide book. In Eclipse, I used the XML given in the book and I got the error XML document structures must start and end within the same entity.
How do I fix this?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="24dp"
android:text="#string/question_text" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/true_button" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/false_button" />
</LinearLayout>
</LinearLayout>
Problem is solved. I removed the code and saved the xml file. After that, I replaced it with the above code and saved. The error is gone. It was probably a remanant from the time when "automatically build project" was enabled.
Strange.
I just created a new projet, building some layouts, writing some code. Everything was fine except I got this error as shown in the picture below.
I tried to remove and type it again and when typing 'R.id.', there was no 'container' showing up in the list. So that means theres no problem with my R file, just that the 'container' word lost somewhere.
Those code above are actually default code in onCreate() method in your main activity everytime you create a new project in Android Studio. (I actually tried to create a new project to compare and yes it's the same, and without error as it's brand new.).
All I did was comment out the if statement block so the error goes away, and the application has run just fine on the emulator. I just don't know why I got that problem and how I can handle it as I may need to do that in the future. Thank you!
Edit after #Raghunandan has mentioned: Below is my xml.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/provide_information"
android:id="#+id/provideInfoButton"
android:layout_alignParentTop="true" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/take_picture"
android:id="#+id/takePictureButton"
android:layout_below="#+id/provideInfoButton"
android:layout_alignParentLeft="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView"
android:layout_below="#+id/takePictureButton"
android:layout_centerHorizontal="true"
android:layout_marginTop="28dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/classNameTextView"
android:layout_above="#+id/personNametextView2"
android:layout_centerHorizontal="true"
android:layout_marginBottom="44dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginBottom="38dp"
android:layout_above="#+id/emailTextView"
android:layout_alignLeft="#+id/emailTextView"
android:id="#+id/personNameTextView" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/emailTextView"
android:layout_alignParentBottom="true"
android:layout_alignLeft="#+id/classNameTextView"
android:layout_marginBottom="82dp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/send_button"
android:id="#+id/sendButton"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
The reason is that I changed the root layout to RelativeLayout (the default of Android Studio was FrameLayout which has an id of "container"). My bad :). Thanks for mentioning about posting the xml file. I have not noticed that as I'm not as familiar with Android Studio as with Eclipse yet.
I wrote code for Admob. This is my layout.xml file code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:id="#+id/relativeLayoutHomeParent"
tools:context=".Home" xmlns:app="http://schemas.android.com/apk/lib/com.google.ads">
<RelativeLayout
android:id="#+id/relativeLayoutHomeTopBar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<TextView
android:id="#+id/textView1"
android:text="Home"
style="#style/screen_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:id="#+id/imageViewHomeSettings"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="#drawable/set_settings"
android:layout_marginRight="10dp" />
</RelativeLayout>
<View
android:id="#+id/view1"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_below="#+id/relativeLayoutHomeTopBar"
android:background="#drawable/shadow" />
<ListView
android:id="#+id/listViewHome"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#BDBDBD"
android:dividerHeight="1dp"
android:layout_below="#+id/view1" >
</ListView>
<com.google.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
app:adSize="BANNER"
app:adUnitId="a1512f50d8c3692"
app:loadAdOnCreate="true"
app:testDevices="TEST_EMULATOR, TEST_DEVICE_ID" >
</com.google.ads.AdView>
Output:
I want the bar that is on the top(yes that black bar), on the bottom of the screen. I also wrote for it but it showed the output as the above image.
Also i dont understand that which one is the admob banner, the top one or the bottom one ?? Can anyone please explain the difference these two bars. Actually i am new to this. This is the first time i've code for admob. Please help me to learn on this.
Maybe the ADK update has messed-up with your project's build-path. Try removing the admob JAR and add it again to your libs folder, add it to your Build Path and do a Clean Project.
EDIT following poster's comment about not having a libs folder:
You should try this:
Remove all references to the AdMob JAR in your project -> your code should not build without error anymore
Create a libs folder at the root of your project.
Copy the AdMob JAR into the libs folder
Make sure this AdMob JAR is in your Build Path (this will allow your code to build wihtout error)
(If still not running OK) Right click your project > Android Tools > Fix Project Properties