String error in MainActivity in Android studio - android

I am having issues with resolving R in Android studio. Here is a screenshot of my error:
As you can see, the error is with the layout width String in wrap_content.I do not understand why this is an error since xml allows you to assign wrap_content to layout_width
http://217.199.187.200/pentaworld.com/content_main.jpg
http://217.199.187.200/pentaworld.com/content_main_2.jpg

Related

Android Studio error : Invalid content found from the 'base-extension' element

I am trying to compile an Android Application on Android Studio and I get this error:
cvc-complex-type.2.4.a: Invalid content found from the 'base-extension' element. One of the values '{layoutlib}' is expected.
Do you know where this could come from?

Invalid color in Android Compilation. How to fix .9.png

I'm getting the following error when compiling in Android Studio
Android resource compilation failed
Output: error: found an invalid color.
The image that is causing the error is already a .9.png file and it looks like this in Android Studio
I am not sure how to solve this. I referred to this two questions
How can I track down the cause of Android "found an invalid color" error
Android : 9-Patch image Error
and both indicate that the border around the image should be transparent. I'm guessing I have to fix the "bad patches" shown in red. if that's the case how can I fix them and make the compilation succeed?

How do I fix Error: Duplicate id in Android Studio

I getting
Error:(7) Error: Duplicate id #+id/item, already defined earlier in
this layout [DuplicateIds]'
I'm using Android Studio. How can I fix it? Thanks in advance.
If you using text layout and check the xml code for finding the red line(indication of error) in android studio.
If you have than change the value like shown in the image and finally clean and build the project.
Error Image
After change the id
Maybe you had defined two view with the same id.Check your code.(ctrl+f)
It is not the as's fault.

Exception raised during rendering in Eclipse

I have an error in Android xml layout as follows :
Exception raised during rendering: <include /> can only be used inside of a ViewGroup
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- android.support.v7.internal.widget.ActionBarOverlayLayout (Fix Build Path, Edit XML, Create Class)
Now, When I am changing the AppTheme to Theme.Holo than its working fine.
I want to know that Why is it like this ?

Resource not found exception

I am trying to use datepicker in my project. But as soon as I run the project, it throws "Resource not found exception" and following line appears when I drag datepicker in xml file
The following classes could not be found:
- CalendarView (Change to android.widget.CalendarView, Fix Build Path, Edit XML)
- DatePicker (Change to android.widget.DatePicker, Fix Build Path, Edit XML)
logcat entries are as follows:
FATAL EXCEPTION:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.dateandtimepick/com.example.dateandtimepick.MainActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x16
How can I rectify the code. Thanks in advance.
android.content.res.Resources$NotFoundException: String resource ID #0x16
You are trying to set int value in
tetview.setText() or Toast.makeText(), which it will take as string resource id.
So try to give int value in like this
.setText(""+intvalue) or Toast.makeText(context,""+intvalue,..)
I solved the "Resource not found" exception by re-installing the Android SDK. For some reason, while packing the apk, the SDK tools weren't packing the resources. Its' a build error (silent error) that yells only at runtime. I did not need to reinsatll JDK or eclipse.
Try to clean to Project to rebuild the R.java
Rebuild the xml by creating a new xml,I guess maybe you forget to add the namespace (xmlns:android="http://schemas.android.com/apk/res/android")
Hope I can help.

Categories

Resources