
Android เรียกใช้งาน REST API ด้วย retrofit2.3
1.สร้าง project 1.1 ไปที่ File => New Project ใส่ชื่อ project และ Company domain เลือก Empty Activity 1.2 ไฟล์ build.gradle (Module: app) ใส่
1 2 3 4 5 6 7 8 9 10 11 12 13 |
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support.constraint:constraint-layout:1.0.1' testCompile 'junit:junit:4.12' // retrofit, gson compile 'com.squareup.retrofit2:retrofit:2.3.0' compile 'com.squareup.retrofit2:converter-gson:2.3.0' } |