google-developer-training / android-basics-kotlin-amphibians-app Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
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)
}
}
When I use Base URL: https://developer.android.com/courses/pathways/android-basics-kotlin-unit-4-pathway-2/ for retrofit (which is provided in the codelab) , I get 404. I can hit the json directly though (https://developer.android.com/courses/pathways/android-basics-kotlin-unit-4-pathway-2/android-basics-kotlin-unit-4-pathway-2-project-api.json). I'll double check my code to see what's up
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!
In which task and step of the codelab can this issue be found?
3
Describe the problem
After To click run button I see:
Steps to reproduce?
show many errors as on my first screenshot and attached file:
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.
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?
Versions
Android Studio version:
API version of the emulator: 31
Additional information
Include screenshots if they would be useful in clarifying the problem.
Very hard to complete when the people writing this stuff never respond.
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....
This page displays Lemonade app test instead of Amphibians Test.
Bad Test instruction in course
In update the UI from the ViewModel , step 1 , we can not call the getAmphibianList() method from the ViewModel in AmphibianListFragment because it is a private method , it's better to add init {getAmphibianList()} in the AmphibianViewModel
Testing instructions are not related to amphibians application.
Solution file missing. Please create and add to the end of code lab.
This issue remains open and is still affecting the project. Please fix.
#1
Instructions in codelab is incomplete, fortunately i was able to search the solution code, but this made unnecessary confusion.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.