Giter Site home page Giter Site logo

android-basics-kotlin-amphibians-app's People

Contributors

owenscott-gds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

android-basics-kotlin-amphibians-app's Issues

Android Basics: Amphibians app

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

Issue Description:
I've implemented the app per instructions, but upon running the app the connection error drawable is displayed. After doing some logging, I have discovered this is because my retrofit request returns HTTP code 404. Reviewing the instructions, I see the following:

The backend for this API is fairly simple. There are two key pieces of information you'll need to access the amphibians data: a base URL and an endpoint to get the list of amphibians.

Base URL: https://developer.android.com/courses/pathways/android-basics-kotlin-unit-4-pathway-2/
GET amphibians list: android-basics-kotlin-unit-4-pathway-2-project-api.json

I am familiar working with the base URL, passing it into the retrofit builder, but I am not sure what to do with the 'GET amphibians list URI. I know this is needed to resolve my retrofit request successfully, but after reviewing the previous CodeLabs I am not sure how to use this information in my AmphibianApiService.kt file. Surely, this must be passed to retrofit somehow?

Any clarification would be greatly appreciated.

I've currently based my implementation of AmphibianApiService.kt file off of the MarsApiService.kt file from the previous CodeLab:

// Create a property for the base URL provided in the codelab
private const val BASE_URL = "https://developer.android.com/courses/pathways/android-basics-kotlin-unit-4-pathway-2/"

// Build the Moshi object with Kotlin adapter factory that Retrofit will be using to parse JSON
private val moshi = Moshi.Builder()
    .add(KotlinJsonAdapterFactory())
    .build()

// Build a Retrofit object with the Moshi converter
private val retrofit = Retrofit.Builder()
    .addConverterFactory(MoshiConverterFactory.create(moshi))
    .baseUrl(BASE_URL)
    .build()

interface AmphibianApiService {
    // Declare a suspended function to get the list of amphibians
    @GET("amphibians")
    suspend fun getAmphibians(): List<Amphibian>
}

// Create an object that provides a lazy-initialized retrofit service
object amphibianAPI {
    val retrofitService: AmphibianApiService by lazy {
        retrofit.create(AmphibianApiService::class.java)
    }
}

Solved All Issues

I fixed all the errors I encountered and put them on another repository of mine because the project was created on a different version of Android Studio that doesn't go along with the version I have now and since the Google training team is no longer maintaining this course and will mark it as deprecated by Dec 2023, I had no option except to create another repository. So here is my repository

Happy coding!

fail run empty project

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

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

Describe the problem
After To click run button I see:

image

Steps to reproduce?

  1. unzip source
  2. File > New > Import Project > folder android-basics-kotlin-amphibians-app-main
  3. Show Tooltip
    image
  4. click it
  5. show popup:
    image
  6. Click button "Begin...."
  7. show bottom Assistant:
    image
  8. click "run selected steps"
  9. show tooltip, click that
    image
  10. click OK:
    image
  11. migration...
    image
  12. click green triangle "run app" on my tablet via usb.

show many errors as on my first screenshot and attached file:

log.zip

Versions
Android Studio version:
Android Studio Chipmunk | 2021.2.1 Patch 2
Build #AI-212.5712.43.2112.8815526, built on July 10, 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: 8
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: com.yemreak.DarkCode-Theme (1.1), com.markskelton.one-dark-theme (5.6.0), atom-one (1.5.1), com.vincentp.gruvbox-theme (0.5.5), org.jetbrains.kotlin (212-1.7.10-release-333-AS5457.46)

API version of the emulator:

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

Dependencies and Build Issues

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

In which task and step of the codelab can this issue be found?
Task - Project Amphibians

Describe the problem
The dependencies and build of the starter code is not up to date causing problems for the app to even run for the first time. I have tried updating the dependencies and plugins from another Project but could not solve the problem.

Steps to reproduce?

  1. Go to Android Studio
  2. Click on Run
  3. See error

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

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

Android Basics: Amphibians app--------Error in GENERATED SOURCE FILE

there is a error in DataBinderMapperImpL

Nothing was touched. It says these files should not be edited, yet you guys have a error in it. How can it be fixed if it can't be edited from a mistake you guys made when you built it?

it is the first line underlined in red.

PLEASE TELL ME HOW TO FIX IT.

screen shot below....

Screen Shot 2022-02-16 at 7 39 54 AM

Android Basics: Amphibians app

Instructions in codelab is incomplete, fortunately i was able to search the solution code, but this made unnecessary confusion.

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.