Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Rendering issue in Android Studio, Views are not Displaying

This is my gradle , I search over internet many times but i am not getting any solution . I already used many thing to solve but i am not getting eject answer to my question, Please help me.

apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
dataBinding { enabled = true }

defaultConfig {
    applicationId "com.android.application"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

repositories {
    mavenCentral()
    flatDir {
        dirs 'libs'
    }

}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'cz.msebera.android:httpclient:4.4.1.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.+'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile(name: "truesdk-0.5", ext: "aar")
}
apply plugin: 'com.google.gms.google-services'

1 Answers

I faced the same problem. Actually this problem comes from style.xml

  1. Each new version of Android provides a new API level and new features.
  2. If you are following someones code and they are using something like extends ActionBarActivity or just extends Activity, that was fine for the SDK API the were using at the time they wrote it.
  3. When you start a new blank activity (or in version24 an empty activity), AND the min API you want to support is less than the current API, Android will create the activity extending AppCompatActivity. Id does this so it can support older API levels.
  4. The theme is tied to the Activity type the Activity extends.

Solutions are :

<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>

or,

  1. First you have to Sync your project.
  2. Next, go to Build menu, and clic on the Clean Project.
  3. Finally, again, go to Build menu, and clic on the Rebuild option.
like image 131
Abhishek Kumar Avatar answered Feb 02 '26 11:02

Abhishek Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!