新增Retrofit dependencies
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
於 manifests/AndroidManifest.xml
新增請求許可
<uses-permission android:name="android.permission.INTERNET" />
建立 GET 請求
@GET("/")
suspend fun getContents(): String