Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App (2014) Creating the Screen Layout Adding a Button

Matthew Grant
Matthew Grant
3,703 Points

My Android emulator does not show current project code

I am currently up to the end of the 'adding a button' stage of the build a fun fact app. When I use my mobile emulator and launch the app, it only shows a blank screen with 'hello world' and not the design and code that's been added up to this point :S. Does someone know how to fix this? Thank you :).

Edit: Also, currently my run button is greyed out :S, with 2 background tasks constantly running :S.

One is 'Gradle: Executing Tasks [:app:assembleDebug]

The other is 'Gradle: Executing Tasks [clean, :app:generateDebugSources, :appLgenerateDebugTestSources]

1 Answer

Alessandro Calorì
Alessandro Calorì
10,241 Points

The tasks running in the background are about IDEA (Android Studio) compiling your app. Until it finishes nothing should happen in the emulator. If it gets stuck close Android Studio and when it asks you if you want to halt the execution of the background tasks say "yes". When you run AS again invalidate the cache ("File" menu), clean the project ("Build" menu) and try again to run your app.

PS: do NOT overwhelm Android Studio with compilation/run tasks. It is still in beta and it does not handle very well high load conditions.

Matthew Grant
Matthew Grant
3,703 Points

Hi Alessandro,

Thank you for answering my question :). I followed your instructions and attempted to run the app again but it's been 10 minutes and is still attempting to execute 'Tasks [:app:assembleDebug] :S.

Alessandro Calorì
Alessandro Calorì
10,241 Points

What JDK did you install on your PC? In the bottom right side you should have a "Gradle console" which should show you the status of the compilation task. What does the console shows?

Matthew Grant
Matthew Grant
3,703 Points

The JDK installed on my PC is 'Java SE Development kit 8 Update 25 (64-bit) and one without an icon saying 'Java SE Development Kit 8 Update 25'.

My Gradle console currently says the following when I attempt to run the app:

Executing tasks: [:app:assembleDebug]

Configuration on demand is an incubating feature. :app:preBuild :app:compileDebugNdk :app:preDebugBuild :app:checkDebugManifest :app:preReleaseBuild :app:prepareComAndroidSupportAppcompatV72100Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42100Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:compileDebugJava :app:preDexDebug