Git Product home page Git Product logo

android-basics-kotlin-dessert-clicker-app's Introduction

DessertClicker - Code

Code for Android Basics Codelab.

Introduction

DessertClicker is a game about making desserts. Press the button, make a dessert, earn the big bucks.

You use this app in the course to explore the Android lifecycle and log messages to the Android console (Logcat).

Pre-requisites

You need to know:

  • How to open, build, and run apps with Android Studio.
  • What an activity is, and how to create one in your app.
  • What the activity's onCreate() method does, and the kind of operations that are performed in that method.

Getting Started

  1. Download and run the app.

android-basics-kotlin-dessert-clicker-app's People

Contributors

jkcoolmom avatar jwill avatar osuleymanova avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

android-basics-kotlin-dessert-clicker-app's Issues

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?authuser=1&continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%3Fauthuser%3D1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#3

In which task and step of the codelab can this issue be found?
3

Describe the problem
onStop and onDestroy is actually not called in my android studio

Steps to reproduce?

  1. Go to...logcat
  2. Click on...
  3. See error...

Versions
_Android Studio version: Android Studio Bumblebee 2021.1.1 Canary 2
_API version of the emulator: Pixel XL API Sv

Additional information
Include screenshots if they would be useful in clarifying the problem.
image

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#1

In which task and step of the codelab can this issue be found?
App overview

Describe the problem
Build error:

Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;29.0.2 Android SDK Build-Tools 29.0.2
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

Using Android SDK: /Users/thaz/Library/Android/sdk

Steps to reproduce?

  1. Go to...

Android Studio 4.1.1
Build #AI-201.8743.12.41.6953283, built on November 5, 2020
Runtime version: 1.8.0_242-release-1644-b3-6915495 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6
GC: ParNew, ConcurrentMarkSweep
Memory: 2014M
Cores: 4
Registry: ide.new.welcome.screen.force=true, external.system.auto.import.disabled=true
Non-Bundled Plugins: com.thoughtworks.gauge, com.vladsch.idea.multimarkdown, com.intellij.marketplace, org.jetbrains.kotlin

  1. Import...

android-basics-kotlin-dessert-clicker-app

  1. See error...

Press on "Run App" creates a build error.

Versions
Android Studio version: 4.1.1
API version of the emulator: ? App sent to physical device: Xiomi Redimi Note 7

Additional information
Bildschirmfoto 2021-01-21 um 12 44 17

I don't know why but following steps fixes it:
Go to: build.gradle (Module: Dessert_Clicker.app)
Add: buildToolsVersion "30.0.3"
inside android {}

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.android.dessertclicker"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
dataBinding true
}
}

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#4

In which task and step of the codelab can this issue be found?
[5. Explore configuration changes]
Compile and run the app, and click the Home button to put it into the background. Notice that the onSaveInstanceState() callback occurs just after onPause() and onStop():

Describe the problem
my log shows the onSaveInstanceState() callback occurs between onPause and onStop, not after them as the codelab say

Steps to reproduce?

  1. Go to... Compile and run the app, and click the Home button to put it into the background.
  2. Click on... Home
  3. See error... 2022-09-14 16:46:27.600 6056-6056/com.example.android.dessertclicker D/MainActivity: onPause Called
    2022-09-14 16:46:27.964 6056-6056/com.example.android.dessertclicker D/MainActivity: onSaveInstanceState Called
    2022-09-14 16:46:27.965 6056-6056/com.example.android.dessertclicker D/MainActivity: onStop Called

Versions
Android Studio version: Chipmunk | 2021.2.1 Patch 1
API version of the emulator: real device API 26

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#2

In which task and step of the codelab can this issue be found?
It says "Note: A good convention is to declare a TAG constant in your class:

const val TAG = "MainActivity""

Describe the problem

Android Studio complains that it is only allowed to use const modifier in companion object or top level. So the declaration should not be IN the class but before (or using a companion object).

Steps to reproduce?
none

Versions
_Android Studio version:Build #AI-213.7172.25.2113.9014738, built on August 31, 2022
_API version of the emulator:31.3.11-9058569

Android Studio Dolphin | 2021.3.1
Build #AI-213.7172.25.2113.9014738, built on August 31, 2022
Runtime version: 11.0.13+0-b1751.21-8125866 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 8
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false

Additional information
Include screenshots if they would be useful in clarifying the problem.
image

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle#4

In which task and step of the codelab can this issue be found?
Data loss on device rotation

Describe the problem
After changes to device orientation on the AVD, the lifecycle methods are not called. On the other hand, when the app is run on an actual device, the lifecycle methods are called, as stated in the webpage.

Steps to reproduce?
As stated above.

Versions
Android Studio version: 4.2.1
API version of the emulator: 30

Additional information
Nil.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?authuser=1&continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%3Fauthuser%3D1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#4

In which task and step of the codelab can this issue be found?
Task 5

Describe the problem
It says : "Data loss on device rotation", but I tried this and there were no log entries or data loss on device rotation. I tried this using emulator

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#4

In which task and step of the codelab can this issue be found?
Use onCreate() to restore bundle data

Describe the problem
Instruction code is missing nullable declaration. Should be:

override fun onCreate(savedInstanceState: Bundle?) {

Steps to reproduce?
N/A

Versions
N/A

Additional information
Screenshot
image

Android Basics: Activity Lifecycle

URL of codelab

https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#4
In which task and step of the codelab can this issue be found?
Part 5 explore configuration changes

Describe the problem

Data loss on device rotation
The app works fine from 0 to 5 but when the image change, from 6 or more the app stop working

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://github.com/google-developer-training/android-basics-kotlin-dessert-clicker-app/issues/new?&title=Android%20Basics%3A%20Activity%20Lifecycle

In which task and step of the codelab can this issue be found?
Explore configuration changes

Describe the problem
App does not support rotating screen. Stays in protrait mode.

Steps to reproduce?

  1. Go to...

  2. override fun onSaveInstanceState(outState: Bundle) {
    super.onSaveInstanceState(outState)

    Log.d(TAG, "onSaveInstanceState Called")
    }
    Run the app

  3. Click on... cupcake a few times

  4. Rotate the device (emulator, Pixel 6 API 30)

  5. Nothing happens

Versions
Android Studio version: Electric Eel|2022.1.1
Build #AI-221.6008.13.2211.9477386, built on January 10, 2023
Runtime version: 11.0.15+0-b2043.56-8887301 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
API version of the emulator: (emulator, Pixel 6 API 30)

Additional information
Include screenshots if they would be useful in clarifying the problem.
Screenshot (6)

Android Basics: Activity Lifecycle

https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#0

1. Welcome

It seems little difficult to understand the meaning of the following sentence even after reading 2-3 times:
"As a user navigates between activities in your app (and into and out of your app), those activities each transition between different states in the activity lifecycle."

As a reference, I am mentioning that, I have scored 8 in IELTS Reading, and I read English everyday.
Version: Last updated Jan 29, 2022

I believe, like other sentences, more clarity is possible to achieve in the above mentioned sentence.
Thank you.

Android Basics: Activity Lifecycle - no onStart() listed in Override Memebers list

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%3Fhl%3Den%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle&hl=en#2

In which task and step of the codelab can this issue be found?
Step 2: Implement the onStart() method > Step 1.

Describe the problem
While the steps suggest we open the Override Members screen and find the onStart() member, I cannot find it in the list.

Versions
Android Studio Bumblebee | 2021.1.1 Patch 2
Build #AI-211.7628.21.2111.8193401, built on February 16, 2022
Runtime version: 11.0.11+9-b60-7590822 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 8
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40), org.intellij.plugins.markdown (211.7142.37)

Additional information
image

Android Basics: Activity Lifecycle -- Android SDK Build-Tools Version

URL of codelab
Stages of App lifecycle - App overview

In which task and step of the codelab can this issue be found?
I found a compatibility issue when try to build and run the project.

Describe the problem
When I downloaded the project and tried to run it, the app would work. Instead, the Android Studio prompt an error in the "Build" dialog.

Steps to reproduce?

  1. Go to... Top menu panel
  2. Click on...Run "app"
  3. See error..."Failed to find build tools revision 29.0.2 - Android Studio"

Versions
Android Studio version: 4.2
API version of the emulator: 30

Additional information
image

Addressing the problem

  1. Solution A: download Android SDK Build-Tools 29.0.2
    1.1 Step I: Open File > Settings
    1.2 Step II: Select Appearance & Behavior > System Settings > Android SDK
    1.3 Step III: Follow the steps in picture and make sure that check "29.0.2"
    image
    1.4 Step IV: the app should be running without any problem.

  2. Solution B: Specified in the file build.gradle (switch to Android from Project and File path: "Gradle Scripts > build.gradle(Module: Dessert_Clicker_app)")
    2.1 Step I: find andorid {...}
    2.2 Step II: add "buildToolsVersion ${current build tool version}" under the line of "compileSdkVersion 30"
    2.3. Step III: Tab "Sync" on top of the editor as the line finished
    2.4. Step VI: run the app, it sould be working

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#2

In which task and step of the codelab can this issue be found?
3. Explore the lifecycle methods and add basic logging

Describe the problem
NOT A REAL PROBLEM!! But I wasted some time on this and had to google for the answer I would like to save others from same issue. Basically my emulator (pixel 5) doesn't have auto rotation on by default. So when the lab says

"Note: As you experiment with your device and observe the lifecycle callbacks, you might notice unusual behavior when you rotate your device. You'll learn about that behavior later in this codelab."

That is misleading. No matter how many times you click the rotate left or rotate right buttons in the emulator, nothing happens!! The only fix is to go into settings on the emulator in display and turn on auto-rotating. Then yes, the lab makes more sense #42

Steps to reproduce?

  1. Click the rotate left or rotate right button in the emulator, nothing happens until you turn on auto rotating in the emulator which is off by default :)

Versions
Android Studio Chipmunk | 2021.2.1 Patch 1
Build #AI-212.5712.43.2112.8609683, built on May 18, 2022
Runtime version: 11.0.12+0-b1504.28-7817840 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 4
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: Dart (212.5744), org.intellij.plugins.markdown (212.5457.16), org.jetbrains.kotlin (212-1.7.10-release-333-AS5457.46), io.flutter (69.0.2)

Additional information
Include screenshots if they would be useful in clarifying the problem.
auto rotate off by default

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#4

In which task and step of the codelab can this issue be found?
Explore Configuration Changes

Describe the problem
While calling showCurrentDessert() method form onCreate() method when I rotate device's screen it only updates the image.

So I tried calling onDessertClicked() method instead of showCurrentDessert() it both updates the image, Desserts Sold and
the price but it increments the Dessert Sold and price each time I rotate the device screen.

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
Android Studio 4.1.1
API version of the emulator:
Using the actual device running on android pie

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#4

In which task and step of the codelab can this issue be found?
7. In onCreate(), in the block that restores the state from the bundle, call showCurrentDessert()

Describe the problem
if call showCurrentDessert() in onCreate(), app will crash when change orientation. the correct place to add this line of code should be onStart(), or onResume()

Steps to reproduce?

  1. Go to... Dessert Clicker app, tap on the dessert at least 5 times so the dessert image change
  2. Click on... click on the orientation from configuration tools on the emulator
  3. See error... app crashes

Versions
Android Studio version: Bumblebee
API version of the emulator: API 29

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle

In which task and step of the codelab can this issue be found?
2. App Overview
3.
Describe the problem
MainActivity.kt, the first line of onShare() is:
val shareIntent = ShareCompat.IntentBuilder.from(this)

The word "from" is shown with a strikethrough and there is a "Problem" that says
"'from(Activity): ShareCompat.IntentBuilder' is deprecated. Deprecated in Java"

This does not prevent the app from running, but should be updated.

Steps to reproduce?

  1. Go to... This Codelab and MainActivity.kt
  2. Click on... the Problems tab
  3. See error...

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?authuser=1&continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%3Fauthuser%3D1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#3

In which task and step of the codelab can this issue be found?
Step 4

Describe the problem
In Use case 1, in step 4, it says: "Notice that none of the DessertClicker logs from the previous activity has been retained."

But I found out that these Logs are retained on logcat.

Also it says: "Note: The key point here is that onCreate() and onDestroy() are only called once during the lifetime of a single activity instance: onCreate() to initialize the app for the very first time, and onDestroy() to clean up the resources used by your app."

But onCreate and onDestroy were called many times as shown in the screenshot

only the information is reset: desserts sold and price

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

image

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#4

In which task and step of the codelab can this issue be found?
7. In onCreate(), in the block that restores the state from the bundle, call showCurrentDessert():

Describe the problem
the application crashes when you flip the screen after changing the picture

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#3

In which task and step of the codelab can this issue be found?
4. Explore lifecycle use cases, Use case 1, Step 4

Describe the problem
emulator shows no apps in the Overview. Restarting Dessert app from Home does nothing.

Steps to reproduce?
Follow web page instructions for steps 1,2,3.

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version: 4.1.2
API version of the emulator: ???
Pixel 2 API30 device

Additional information
Include screenshots if they would be useful in clarifying the problem.
image

Android Basics: Activity Lifecycle

URL of codelab

https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#3

In which task and step of the codelab can this issue be found?

Inside Use case 3: Partially hide the activity section, last paragraphs to be specific.

Describe the problem

The codelab doesn't clearly explain how and why the execution of onPause() lasts for short period of time as it only states, as I quote:

The interruption with only onPause() usually lasts a short time before returning to your activity or navigating to another activity or app.

It is also not clear how the codes inside onPause() blocks other things from displaying as it also states:

Whatever code runs in onPause() blocks other things from displaying, so keep the code in onPause() lightweight. For example, if a phone call comes in, the code in onPause() may delay the incoming-call notification.

Already went through these

[Codelabs] Android Basics: Activity Lifecycle Keyboard shortcut typo

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle#2

In which task and step of the codelab can this issue be found?
Task 3 - Explore the lifecycle methods and add basic logging
Step 2 > In Android Studio, with MainActivity.kt open and the cursor within the MainActivity class, select Code > Override Methods or press Control+o (Command+o on Mac). A dialog appears with a huge list of all the

Describe the problem
In the mentioned step it mentions that the "Override Methods" can be opened via Command+O on Mac but the shortcut is Control+O on Mac as well.
Screenshot 2021-06-22 at 2 15 38 PM

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version: Android Studio 4.2.1
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#2

In which task and step of the codelab can this issue be found?

"Stages of the activity lifecycle" -> Step #3 (Explore the lifecycle methods and add basic logging)

Describe the problem

The onDestroy log is never emitted -- should be logged before calling super class (similarly of all "close" activities for more correctness)

These should be as follows (in particular, onDestroy() otherwise the log isn't emitted)

override fun onPause() {
Log.d(TAG, "onPause Called")
super.onPause()
}

override fun onStop() {
Log.d(TAG, "onStop Called")
super.onStop()
}

override fun onDestroy() {
Log.d(TAG, "onDestroy Called")
super.onDestroy()
}

Steps to reproduce?
Follow the lab -- note that onDestroy log is never emitted to Logcat

Versions
Android Studio version: 2021.2.1 Patch 1
API version of the emulator: (n/a -- running on real device, Android 12, Pixel 6)

Additional information

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#1

In which task and step of the codelab can this issue be found?
Task: Stages of the activity lifecycle
Step: 2) App overview

Describe the problem
The starter code given is actually the completed code.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle

In which task and step of the codelab can this issue be found?
In step 3 of the Stages of the activity lifecycle.

Describe the problem
There is a note to create a const val called TAG and assign it a value of MainActivity in the class.
This needs to be done outside of the MainActivity Class. When you create this in the class you produce the error,
"Const 'val' are only allowed on top level or in objects"

Steps to reproduce?

  1. Go to Android sudio and in code add; const val TAG = "mainActivity" inside your class
  2. Try to run your code. There is an error: "Const 'val' are only allowed on top level or in objects"

Versions
Android Studio version: 2020,31 Patch 4
API version of the emulator: does not matter.

Additional information
To resole: just move the statement below the import statements and above the class declaration

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#1

In which task and step of the codelab can this issue be found?
bulding the app

Describe the problem
i sownlaod the app normaly from GitHub then opened it in android studio arctic fox
then the app won't build cause the gradel version is old so every time i have toc change to the newer version

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version: arctic fox 2020.3
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle

In which task and step of the codelab can this issue be found?
Step 4

Describe the problem
The onDestroy() event handler never got triggered when clicking the "Back" icon in the emulator, and even when removing the app from the recent apps,

Steps to reproduce?

  1. Just add the activity's life cycle's events from Step 2.
  2. Run the emulator.
  3. Click the Back button of the emulator or close the app from the recent activities.
  4. Notice the logs.

Versions
Android Studio version: Chipmunk | 2021.2.1
API version of the emulator: 31.2.10-8420304

About Android Studio
Android Studio Chipmunk | 2021.2.1
Build #AI-212.5712.43.2112.8512546, built on April 28, 2022
Runtime version: 11.0.12+7-b1504.28-7817840 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 16
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin (212-1.7.0-release-281-AS5457.46)

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#2

In which task and step of the codelab can this issue be found?
Under "Stages of the activity lifecycle" => "Explore the lifecycle methods and add basic logging" => "Step 1: Examine the onCreate() method and add logging" => "6. In the Logcat window, type D/MainActivity into the search field."

Describe the problem
Given Logcat has changed (New Logcat), the instructions on using Logcat are out-of-date and no longer work.

Steps to reproduce?

  1. Follow the Code Lab and attempt to perform step "6. In the Logcat window, type D/MainActivity into the search field."

Versions
Android Studio Dolphin | 2021.3.1 Patch 1

Additional information
Here's the filter command I used to see the expected output
image

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/courses/quizzes/android-basics-kotlin-unit-3-pathway-1/android-basics-kotlin-unit-3-pathway-1?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23quiz-%2Fcourses%2Fquizzes%2Fandroid-basics-kotlin-unit-3-pathway-1%2Fandroid-basics-kotlin-unit-3-pathway-1

In which task and step of the codelab can this issue be found?

In the question #2 :

Given the following code, what is the result of oneWordCities[1]?
val cities = listOf(“Jeddah”, “Bengaluru” “Shenzhen”, “Abu Dhabi”, “Mountain View”, “Tripoli”, “Bengaluru”, “Lima”, “Mandalay”, “Tripoli”)
val oneWordCities = cities.toSet().toList().filter { !it.contains(“ “)}.sorted()

Describe the problem

  • comma missing between “Bengaluru” and “Shenzhen”,
  • and (typographic quotation marks) characters) should be neutral quotation marks : "

Steps to reproduce?

  1. Go to the quizz
  2. View the question number 2
  3. See error in the sample code of the question

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#3

In which task and step of the codelab can this issue be found?
In 4th step of codelab

Describe the problem
In these sentences, instead of onCreate(), onStart() method should be used.
So what about onRestart()? The onRestart() method is much like onCreate(). Either onCreate() or onRestart() is called before the activity becomes visible. The onCreate() method is called only the first time, and onRestart() is called after that. The onRestart() method is a place to put code that you only want to call if your activity is not being started for the first time.

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#0

The issue can be found on step 4 of the codelab.
Basically the codelab must be updated to new Android 12 behavior. In fact when the back button is pressed the onDestroy() method is no longer called.

Android Studio version: Android Studio Chipmunk
API version of the emulator: Android 12 (API 31)

Android Basics: Activity Lifecycle

URL of URL of codelabcodelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#2

In which task and step of the codelab can this issue be found?
Step 1, Task 6

Describe the problem
Logcat isn't same in tutorial and in Android Studio Dolphin | 2021.3.1 Patch 1
image: https://prnt.sc/Au6v6DeDgcH3

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version: 2021.3.1 Patch 1
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#3

In which task and step of the codelab can this issue be found?
Usecase 1, step 3

Describe the problem
Destroy method isn't called after I press back button in app.

Steps to reproduce?

  1. Run app Dessert Clicker with logs Activity states in overriden methods
  2. Check Logcat
  3. Only onPause and onStop methods are called

Versions
Android Studio version: Runtime version: 11.0.13+0-b1751.21-8125866 amd64
API version of the emulator: Pixel_3a_API_33_x86_64

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#2

In which task and step of the codelab can this issue be found?
Explore the lifecycle methods and add basic logging
Step 2: Implement the onStart() method

Describe the problem
The shortcut to open Override Members in Android Studio on Mac is Control+o, not Command+o.

Android Basics: Activity Lifecycle - Description should mention rotation lock

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle#4

In which task and step of the codelab can this issue be found?
"5. Explore configuration changes"

Describe the problem
Under section "Data loss on device rotation", step 2, we're instructed to rotate the device or emulator into landscape mode to observe a configuration change.

On my emulator, screen rotation was locked by default, preventing a true screen rotation (configuration change) from occurring, and resulting in no log messages. Since the device itself did rotate, I was momentarily confused.

Suggested:

  • Add a step to ensure rotation lock is disabled
  • Add a screenshot of the emulator after rotation

Steps to reproduce?

  1. Click rotate

Expected

  • Device rotates
  • Log messages representing activity destruction and recreation.

Actual

  • Device rotates (but layout does not)
  • No log messages

Additional information
The device itself does rotate, so I believed I had followed the instructions correctly:
Screenshot_1617617326

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#2

In which task and step of the codelab can this issue be found?
Please check the above url, it will open the exact step of the codelab.

Describe the problem
The following statement seems wrong:-
"onCreate() to create the app"

onCreate of activity class will create an object of the activity class.

Android Basics: Activity Lifecycle

URL of codelab

https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%3Fauthuser%3D1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle&authuser=1#4
In which task and step of the codelab can this issue be found?
rotation of the app : no change in the app

Describe the problem

the problem is that the training says that the output in Logcat. Filter the output on MainActivity is not changing .

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

[URL of codelab]
(https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#3)

In which task and step of the codelab can this issue be found?
In 4th task : Explore lifecycle usecases

Describe the problem
It says "using the Back button causes the activity (and the app) to be entirely closed" but it's not really happening when we use back button and again go to the activity using overview screen (recent apps) then it calls restart (onRestart()) method but not onCreate() method as specified in codelab.

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version: Dolphin 2021.3.1 Patch 1
API version of the emulator: API 31

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#3

In which task and step of the codelab can this issue be found?
4

Describe the problem
back button doesn't call onDestroy() function as said in the codelab

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

position of the if clause in onCreate

(https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#4)

In which task and step of the codelab can this issue be found?
5. Explore configuration changes
Use onCreate() to restore bundle data
Step 7

Describe the problem

The if clause:
if (savedInstanceState != null) {
revenue = savedInstanceState.getInt(KEY_REVENUE, 0)
dessertsSold = savedInstanceState.getInt(KEY_DESSERT_SOLD, 0)
showCurrentDessert()
}

have to be after the binding:

binding = DataBindingUtil.setContentView(this, R.layout.activity_main)

otherwise the App will break, if you rotate it.

Android Basics: Activity Lifecycle - Step 5 needs indentation in "Use onSaveInstanceState() to save bundle data"

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?authuser=3&continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%3Fauthuser%3D3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#4

In which task and step of the codelab can this issue be found?
Use onSaveInstanceState() to save bundle data

Step 5 needs indentation.

Describe the problem
The instructions are all indented, except for #5.
Screen Shot 2021-06-13 at 6 47 24 PM

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#4

In which task and step of the codelab can this issue be found?
module 4 Stages of the activity lifecycle
step 4/5 of the codelab

Describe the problem
formatting issues.
the start of step 5 is part of step 4's end , just after transaction too large error.

it should be as a new paragraph/numbered list
Screen Shot 2021-03-27 at 2 46 00 pm

Android Basics: Activity Lifecycle / problem with onDestroy()

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle

In which task and step of the codelab can this issue be found?
3 (Explore the lifecycle methods and add basic logging)

Describe the problem
When overriding onDestroy(), the call to super.onDestroy() has to be at the very end of the method; otherwise, we don't see any logging.
So, the correct code would be:

    override fun onDestroy() {
        Log.d(TAG_LIFECYCLE, "onDestroy called")
        
        super.onDestroy()
    }

Steps to reproduce?

  1. Implement onDestroy() as stated in the codelab
  2. Run the app
  3. Close the app via the Recents menu
  4. No logging for onDestroy() can be found in Logcat

Versions
Android Studio version: Android Studio Bumblebee | 2021.1.1 RC 1
API version of the emulator: tested on a physical device (Pixel 5, Android 12)

Android Basics: Activity Lifecycle

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-activity-lifecycle?hl=fr&continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-3-pathway-1%3Fhl%3Dfr%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-activity-lifecycle#2

In which task and step of the codelab can this issue be found?

Describe the problem
In Android Studio Flamingo, LogCat interface has completly changed for filtering logs

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.

Android Basics: Activity Lifecycle

URL of codelab
https://github.com/google-developer-training/android-basics-kotlin-dessert-clicker-app.git

In which task and step of the codelab can this issue be found?

NAVIGATION/NAVIGATE BETWEEN SCREENS/Stages of the activity lifecycle/a starter app called DessertClicker

Describe the problem

It doesn't work if I solve problem another problem come in
Invoke-customs are only supported starting with Android O (--min-api 26) that is first one

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions
Android Studio version: 4.1.2
API version of the emulator: Android 10

Additional information
Include screenshots if they would be useful in clarifying the problem.
Capture

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.