Related
<TextView
android:layout_width=""
android:layout_height=""
It seems like Android Studio has removed the auto closing tag?
I have browsed and dont find any solution for this....
Here is what its look likes
First confirm that your project has finished background processes like indexing..
Then just typing < you will find suggestion...
After filling the recommended properties you need to type either
/
or
>
autocompletion will happen...
That's all.
Sometimes these issue occurs with the idea.
Just go to File -> Invalidate and Restart
->Press blue button: Invalidate and Restart.
Within one of my methods, I want to switch layouts into a secondary one. But for some reason, the setContentView can't see the layout in the folder. The following images show this:
My layout folder
I then ran the code
setContentView(R.layout.saveg_w_name) //I know this name is correctly spelled and everything since I clicked the createLayout
And yet it still gives the cannot resolve symbol error. Is this a bug with android studio or am I doing something wrong
Just restart your android studio and again check.
If it still doesn't solve your issue, try invalidating caches.
click File(Menu)->Invalidate Caches/Restart
The error I am getting is : "The color "colorRed" in values has no declaration in the base values folder; this can lead to crashes when the resource is queried in a configuration that does not match this qualifier less... "
I have tried clean project and rebuild and also tried invalidate cache & restart but still that error not going.
I have attached screenshot of colors.xml file
I solved the problem cleaning the project and build it again. If it doesn't work, invalidate caches and restart.
I'm using Android Studio 3.2
Invalidate Caches with File > Invalidate Caches / Restart... > Invalidate and Restart
Its a bug, and it happens for dimensions and possibly others. (Not just colours.) First time I saw it was the day I upgraded to AS 3.2.1.
But you may not need to clean, rebuild or invalidate caches. Try this:
(A) Cut and save (e.g. to NotePad) the flagged XML from the base folder and all qualified folders.
(B) Paste it back in, starting with the base folder
Update: 10Jan2019 [Dumb and dumber]
In fact, not even cutting and pasting is necessary. Suppose the following line is giving the problem...
<string name="edit">Edit</string>
Just change the tag to anything. e.g.
<xstring name="edit">Edit</string>
Then wait a second for removal to occur before changing it back
It's a weird bug. but here's a Workaround:
Open the file in android studio and select all the text.
now cut all the text and paste it in the same place.
(or simply, go to the problematic file and press- 'ctrl+A' --> 'ctrl+x' --> 'ctrl+v')
this does not change anything but apparently solves the errors.
This error occures still in AS3.4C10... so it is not solved yet.
For me, the only remedy is to select "Invalidate Cache/Restart" from File menu.
RG
Cleaning Project solved my problem
I might be a bit late to the party, but the latest update of Android Studio (v3.2 Canary 17) seems to have solved this bug.
I had a similar issue with colors and resources and updating Studio seems to have fixed it.
Hope this helps!
This is not an error. It is the IDE bug.
Run the project and error will be automatically resolved.
I quit and restarted Studio and the error went away.
It has occurred for me many times. This appears an Android Studio bug to me.
This may really not be an error though Android Studio shows it temporarily, most likely due to different code in generated files.
Most of the time this error goes if we run build or clean project and rebuild project. Android studio restart is not always required.
If that does not work invalidate cache and restart android studio.
This Error can appear for any of xml files. Not just colors. If you see too many errors, it's surely this one. However, sometimes the error occurs even for just one line. That can be difficult to identify. If you think the error is totally illogical, try a rebuild.
Very rarely I have seen this kind of absurd errors in Kotlin or Java files as well which go away on clean build.
Open Resources->Add new Resource -> choise "New Color value.." other defend on you
I using in android 3.3.1
I'm late to the party, but I fixed this problem by just altering the typing work. I added some more spaces to make it look cleaner and more readable and suddenly the red underline and error messages were gone. Must have been a bug of sorts.
(Studio 3.3.3)
I had same error. I just ran the project with same condition and the error went away.
Did you paste it in from a spreadsheet? If so, just check that everything that looks like a double quote is in fact a double quote. Spreadsheets are a great way to build lengthy resource files, concatenating cells of xml formatting text around cells of names & items etc, but you might find that some of those cells you began with a double quote (e.g. ") will usually have a special open/close-quote character instead. These look like the real thing, but they won't be recognised as xml text indicators, so if e.g. your object name never gets initiated, you'll get this error.
In my case there was literally "no declaration in the base values folder" because the xml file wasn't in the base values folder, after selecting create new file, although the directory tree showed it to be in the values folder.
Find your xml file in the directory tree, select refactor, select move, and look at the path. If there's an invisible addition to the path, delete it back to the proper folder.
I'm new to android programming The drag/ and drop feature in android studio is not working. I can't drag anything to my phone. Right now my fragment is google map view and i want to add a search bar to the view. It just doesn't drag. When I try to add it in text it says element item not allowed here?
This is my activity_maps.xml file
<fragment 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:id="#+id/map" tools:context=".MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment">
<item android:id="#+id/search"
android:title="#string/search_title"
android:icon="#drawable/ic_search"
android:showAsAction="collapseActionView|ifRoom"
android:actionViewClass="android.widget.SearchView" />
</fragment>
the new version of android studio uses 2 xml files for each layout. One (e.g. content_main.xml) embedded in the other one (Activity_main.xml).
you should open the content_*.xml and do the design in it.
hope it helps.
In addition to Hamed's answer I also had to:
File > Invalidate Caches / Restart ...
I'm missing vim.
The drag and drop feature is not working in Android Studio.... I also wasted a lot of time searching...what fixed my problem was to select a Theme for the Activity.
The image below will make things clear.
After updating to the latest version of Android Studio (2.2) I started having this problem.
After some searching and playing around I discovered holding down alt allows my to drag and drop. I had the "hold ALT to drag and drop" option checked under Settings-> Appearance & Behavior > Appearance.
Either I had already selected this option and a fix in Android Studio 2.2 made it so the option applied to dragging and dropping with the palette panel OR this option was recently added and defaulted to checked or a problem happened while upgrading that set it to true.
I have this option set in IntelliJ and have used the android studio palette normally before and am mostly sure I used it without having to hold down alt before so I'm going with option A (and it took me an embarrassing amount of time until I tried holding down alt).
In my case, I was using ConstraintLayout in Android Studio 3.0. Fixed it by using android.support.constraint.ConstraintLayout instead.
Go to your "values" folder
and open the "styles.xml" file.
Replace "Theme.AppCompat.Light.DarkActionBar" under the parent tag with "Base.Theme.AppCompat.Light.DarkActionBar"
I faced this problem also and I simply fixed that by changing the theme to DeviceDefault.Light for the activity.
I also faced the same problem. The culprit was that in my parent
android.support.wearable.view.BoxInsetLayout
tag i was dragging the components directly but when i put
FrameLayout
inside
android.support.wearable.view.BoxInsetLayout
tag and then drag my components to
FrameLayout
it worked .
Hope it will help someone.
I know this is old but not being able to drag elements into the design just happened to me (2/18/18). Restarting Android Studio (3.01) did the trick.
I faced the same problem of not dragging elements in Android Studio 3.1.
Restarting the Android Studio, fixed the problem for me
I figured it out. Even though the design panel is visible as well as the Palette and Component Tree I ALSO need to have app/src/main/res/layout/fragment_main.xml selected over in the Project panel in order for the actual design of the layout to be enabled.
Drag 'n' Drop may not work properly, when you have a LinearLayout, in that condition, the items you drag will try to settle in a specific manner(Horizontal or Vertical), instead try to change your main layout to Relative Layout
Linear Layout --> Relative Layout
I know this is a old issue,none of these were working for me, and it so happened that it wasn't android studio that was giving this problem it was windows. I noticed I couldn't drag anything so clicking and holding any file on the desktop and pressing escape is what fixed it for me.
I resolve this problem by simply rebuild my android studio project.
I was facing the same problem,but then I found the solution .
All you have to do is select the element you want to add(eg. Button) and press "Enter".
The component will be displayed on your screen.
Or you can select the component and right click -> Add to Design
I have did everything in this post, until I've run android studio by just running and not running with "Run As Administrator"(Right Click -> More -> Run As Administrator). I've used to run android studio with "Run As Administrator" and that caused the problem to not drag and drop. Just run Android Studio without "Run As Administrator".
Or try do vice versa and actually "Run As Administrator" if you already just running it without "Run As Administrator".
File>Settings>Appearance and Behavior>Appearance>Theme -> IntelliJ Light
Change your settings to the above path. Then you can drag and drop the views on the design view.
I was also confused with the drag&drop feature. Until I figured out:
After beginning to drag you have to release the mouse button and everything works fine.
Nice feature - a bit unusual though.
I just downloaded Android Studio and ran into this problem.
After clicking random buttons for a few minutes I found out:
There's a magnet icon in the toolbar right above the design view called "Disable Autoconnection to Parent". After I clicked this I was able to move the button wherever.
I get the "Rendering problems. Missing styles. Is the correct theme chosen for this layout?" and the gradle resolving without end after every android studio update, making my entire code non runnable. Only solution is to just recreate my project. Is there any solution to this? It is really, really annoying.
Try to Invalidate Caches and Restart. In Android Studio go to the File menu and choose Invalidate Caches / Restart and confirm with Invalidate and Restart.
An image showing the appropriate menu item in Android Studio:
Simply click on the Refresh icon:
Maybe a bit late, but this may help others...
Had the same problem and had another Error below: failed to find '?attr/textEditSuggestionItemLayout' with 9 similar errors not shown. The textEdit, which i made bold above made me thinking if the error had something to do with the TextView and if the missing styles relate to the TextView Styles. Although I had no more TextView´s in my Layout I gave it a try and added <item name="android:textViewStyle" >#style/AppTheme</item> and it worked, no more error messages to this. Maybe this can still help someone.
Happy coding