Getting Unknown attribute error on all android tag.
In layout XML, Auto suggestion is not showing all attributes (like layout_width, layout_height, orientation, orientation & all others android attributes.)
Here is a Snap shot
Things i have done to resolve this issue.
SDk is up to date.
In App Level Gridle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.abhishek.ondemandservice"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Application level Gride.
buildscript {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
mavenCentral()
}
}
The Android layout_width attribute is used to define the basic width of a view element you have in your layout. The width can be specified in any valid dimension measure ( dp, in, mm, pt, sp, px) Or you can also use the special constant for the width: match_parent and wrap_content. Let’s see some examples of the layout_width attribute in action.
Another way to include a layout is to use ViewStub. It is a lightweight View that consumes no layout space until you explicitly inflate it, at which point, it includes a layout file defined by its android:layout attribute. For more information about using ViewStub, read Loading Views On Demand.
android:layout_gravity is used to set the position of an element in its parent (e.g. a child View inside a Layout ). android:gravity is used to set the position of content inside an element (e.g. a text inside a TextView ).
A layout resource defines the architecture for the UI in an Activity or a component of a UI. The filename will be used as the resource ID. Resource pointer to a View (or subclass) resource.
Just go to Tools->Android->Sync Project with Gradle Files
The only thing that worked for me was cleaning the following folders:
c:\Users\<user>\.gradle\caches\
c:\Users\<user>\.AndroidStudio3.2\system\caches\
Android Studio will just redownload the libraries and caches them which will enable everything back to normal.
Source: https://stackoverflow.com/a/53053438/7515903
Credits: @alexuz
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With