Currently learning on how to build an android app, my xml file should show the text Sup doge
in the layout preview but its not showing at all.
However, the text will show when I build the app & run it on an emulator:
Now I have a problem where I need to constantly build the app just to see any small UI changes in the emulator when I'm supposed to view it in the layout instead.
UPDATE #1:
I tried Invalidate Cache & Restart which was suggested by @Khemraj & removed the constraint attributes. Also removed the tools:text="@string/app_name"
part but its still showing blank in the layout preview. It still shows fine when building the app.
Update #2:
Added background color to check. The preview has a problem.
Update #3
Here are gradle folder files:
gradle-wrapper.properties
file
HeadFirstProject01
file
Anyone can help me fix this problem?
Solution:
Thanks to Khenraj's answer, I was using an unstable sdk ver so I had to update it to the previous stable ver & then build & sync gradle again:
android {
compileSdkVersion 27 //previously was 28
defaultConfig {
applicationId "com.example.headfirstproject_01.headfirstproject_01"
minSdkVersion 14
targetSdkVersion 27 //previously was 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1' //previously was 28.0.0-rc02
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}