Difference between revisions of "Android Studio: HMS Console"

From OnnoWiki
Jump to navigation Jump to search
Line 52: Line 52:
 
         mavenCentral()
 
         mavenCentral()
 
         // Configure the Maven repository address for the HMS Core SDK.
 
         // Configure the Maven repository address for the HMS Core SDK.
         maven {url 'https://developer.huawei.com/repo/'}
+
         maven {url 'https://developer.huawei.com/repo/'} // '''tambahkan'''
 
     }
 
     }
 
     dependencies {
 
     dependencies {
Line 60: Line 60:
 
         // in the individual module build.gradle files
 
         // in the individual module build.gradle files
 
         // Add the AppGallery Connect plugin configuration. You are advised to use the latest plugin  version.
 
         // Add the AppGallery Connect plugin configuration. You are advised to use the latest plugin  version.
                 classpath 'com.huawei.agconnect:agcp:1.6.0.300'
+
                 classpath 'com.huawei.agconnect:agcp:1.6.0.300' // '''tambahkan'''
 
     }
 
     }
 
  }
 
  }

Revision as of 12:49, 9 March 2022

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 > build.gradle

buildscript {
    repositories {
        google()
        mavenCentral()
        // Configure the Maven repository address for the HMS Core SDK.
        maven {url 'https://developer.huawei.com/repo/'}  // tambahkan
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.4"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        // Add the AppGallery Connect plugin configuration. You are advised to use the latest plugin  version.
                classpath 'com.huawei.agconnect:agcp:1.6.0.300' // tambahkan
    }
}


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 (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
}

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'
    implementation 'com.huawei.agconnect:agconnect-core:1.6.4.300' // tambahkan
}


Selain agconnect-core, kita perlu menambahkan implementation untuk HMS kit yang kita gunakan seperti daftar berikut,

Service               Configuration
Auth Service          implementation 'com.huawei.agconnect:agconnect-auth:1.6.4.300'
Remote Configuration  implementation 'com.huawei.agconnect:agconnect-remoteconfig:1.6.4.300'
Cloud Functions       implementation 'com.huawei.agconnect:agconnect-function:1.6.4.300'
Cloud DB              implementation 'com.huawei.agconnect:agconnect-cloud-database:1.5.0.300'
App Linking           implementation 'com.huawei.agconnect:agconnect-applinking:1.6.4.300'
Crash                 implementation 'com.huawei.agconnect:agconnect-crash:1.6.4.300'
APM                   implementation 'com.huawei.agconnect:agconnect-apms:1.5.2.309'
Cloud Storage         implementation "com.huawei.agconnect:agconnect-storage:1.4.0.100"
App Messaging         implementation 'com.huawei.agconnect:agconnect-appmessaging:1.6.4.300'

Detail lainnya bisa di lihat di https://developer.huawei.com/consumer/en/hms

Referensi