Android Studio: HMS Console

From OnnoWiki
Jump to navigation Jump to search

HMS Console penting untuk mengaktifkan HMS Kit. URL di,


Langkah membuat Aplikasi Menggunakan HMS Kit


  • Login Huawei Developer > Console
  • Klik "Distribution and promotion" di atas AppGallery Connect
  • Klik "AppGallery Connect"
  • Klik "My Projects"
  • Klik "Add project"
  • New project > Name : nama-project-yang-kita-buat (misal ITTS HMS Kit Test) > OK
  • Klik "Add app"
  • Isi:
Platform:         Android
Device:           Mobile Phone
App name:         ITTS HMS Kit Test
Package name:     nama.app.anda (contoh itts.onno.hms.kit.test)
App category:     App
Default language: Indonesian
  • Klik OK
  • Lakukan hal yang sama PERSIS di Android Studio, pastikan sama di
App name
Package name

Setup SDK

Download agconnect-services.json

a) Downloaded the agconnect-services.json file.
b) Switch Android Studio to the Project view.
c) Copy the agconnect-services.json file to the app root directory.
  • Copy ke folder src (via File Explorer di OS Ubuntu)
~/AndroidStudioProjects/ITTSHMSKitTest/app/src/


Setup gradle

Edit Projects > Android > Gradle Scripts > settings.gradle

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {url 'https://developer.huawei.com/repo/'}   // tambahkan
    }
} 

Edit Projects > Android > Gradle Scripts > build.gradle (Module: ...)

dependencies {
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    classpath 'com.huawei.agconnect:agcp:1.6.4.300' // tambahkan
}


Edit Projects > Android > Gradle Scripts > build.gradle (Project: ...)

plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
    id 'com.huawei.agconnect' // tambahkan
}