0

I am new to Android Studio and want to know why it does not really work for me.

Basically, I just started learning Android Studio watching an online course, so I am just doing the same thing what the lecturer does on the videos, but the result never turns out the same.

Firstly I want to let you know that I have not touched anything. But Android Studio does not show any of components, such as textView, and when I run it, the ADB(the Emulator) never runs the app but only shows the default screen of an Android phone.

I better attach some screenshots of my Android Studio to show you what is going on.

enter image description here

As you can see from this picture, there is a textView component but it does not appear on the screen that is in the center.

As I wrote above, I did not touch anything. It is just right after I create a new project. No matter what component I add, it never shows up.

I have no idea if it would matter but if you look at the top right, an error occurs (red exclamation mark) that is saying "Render Problem: Failed to load AppCompat ActionBar with unknown error".

I have tried to solve this error for several hours and could not really find a solution to this too.

And when I run the app (by pressing green arrow button), here's what happens.

enter image description here

It just stays on this screen. Nothing really happens after this.

What should I do to see my components and to make it run the app? What am I missing? I really have done exactly the same as the online course I am watching and I see no one is having the problem I am facing now.

Any help?

In case of it will be needed, I am uploading both of my gradle files too:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

This is a gradle file build.gradle (Project: project name)

And the following is a gradle file build.gradle (Module: app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.auclo.exampleapp"
        minSdkVersion 15
        targetSdkVersion 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:28.0.0-rc02'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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'
}

And styles.xml

enter image description here

Thanks.

Auclown
  • 179
  • 1
  • 3
  • 20

4 Answers4

3

This is an issue of version 28, you should downgrade to version 27 until the problem is solved.

Go to your app/Gradle Scripts/build.gradle (Module:app)

where is build.gradle located

1

Change this line:

compileSdkVersion 28

to

compileSdkVersion 27

2

Change this line:

targetSdkVersion 28

to

targetSdkVersion 27

3

Change this line:

implementation 'com.android.support:appcompat-v7:28.0.0-rc02'

to

implementation 'com.android.support:appcompat-v7:27.1.1'

Then Android Studio will ask you to Sync the files, and you do so by clicking in Sync Now

Keep learning how to code, and soon Android will solve this problem. You can see more about this discussion here.

Soon Santos
  • 2,107
  • 22
  • 43
2

I wanted to wait till i'm clear but since everyone is telling him to downgrade the project, here I go.

There's a bug in the newer versions. So if you want to run your project on sdk 28, in your res/values/styles.xml modify the AppTheme style from

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

to

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

Basically waht you have to do is add Base to whatever is already there.

Or

As the others said you can downgrade your project to:

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'

But I think you should always learn on the latest so you're free to choose either options :)

Jacob Celestine
  • 1,758
  • 13
  • 23
2

Go to styles.xml and change

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

to

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

Sambit Mallick
  • 155
  • 4
  • 14
2

Change Depandency

This is an issue of version 28, you should downgrade to version 27 until the problem is solved.

compileSdkVersion 28 to compileSdkVersion 27

targetSdkVersion 28 to targetSdkVersion 27

implementation 'com.android.support:appcompat-v7:28.0.0-rc02'

replace with

implementation 'com.android.support:appcompat-v7:27.1.1'
Ashvin solanki
  • 4,802
  • 3
  • 25
  • 65