HMS-Core / hms-flutter-plugin

This repo contains all of Flutter HMS plugins.
https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1
Apache License 2.0
278 stars 139 forks source link

AGP8 upgrade #341

Open adrianvintu opened 6 months ago

adrianvintu commented 6 months ago

The following configuration worked for me when migrating to AGP8:

build.gradle

buildscript {
    ext.kotlin_version = '1.9.0'
    repositories {
        google()
        jcenter()
        maven { url 'https://developer.huawei.com/repo/' }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:8.1.1'
        classpath 'com.google.gms:google-services:4.3.15'
        classpath 'com.google.firebase:perf-plugin:1.4.2'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.6'
        classpath 'com.huawei.agconnect:agcp:1.5.2.300'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
...

app\build.gradle

...
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
//apply plugin: 'com.huawei.agconnect'

android {
    // Conditional for compatibility with AGP <4.2.
    if (project.android.hasProperty("namespace")) {
      namespace 'my_namespace'
    }

    compileSdkVersion 34
...       

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#https://developer.android.com/studio/releases/gradle-plugin
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip

Forks (if required): https://github.com/adrianvintu/file_saver https://github.com/adrianvintu/flutter_statusbarcolor https://github.com/adrianvintu/hms-flutter-plugin

fleoparra commented 3 weeks ago

Hello. We need this updates in order to prevent the error "Namespace not specified. Specify a namespace in the module's build file." using AGP 8