Android Studio: HMS Setup SDK

From OnnoWiki
Jump to navigation Jump to search

Add Configuration File

  • Download
 agconnect-services.json
  • Copy ke
cp agconnect-services.json ~/AndroidStudioProjects/MyApplication/app/src/


Add SDK

Project-level build.gradle

buildscript{
    dependencies {
        // Add dependencies.
        classpath 'com.huawei.agconnect:agcp:1.5.2.300'
    }
}


App-level build.gradle

plugins {
    id 'com.android.application'
    id 'com.huawei.agconnect'  // tambahkan
}
android {
....
}
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.hms:hwid:6.4.0.300'                  // tambahkan
    implementation 'com.huawei.agconnect:agconnect-core:1.5.2.300'  // tambahkan
}


Referensi