Skip to content

com.android.tools.build:gradle is no set in the build.gradle  #398

Open
@sswedan

Description

@sswedan

Description
I've created a new empty Flutter app with version (3.24.5) and I'm trying to add the "com.huawei.agconnect:agcp" plugin to use Huawei Messaging. When I try to run/build for android I get the following error:

An exception occurred applying plugin request [id: 'com.huawei.agconnect']
> Failed to apply plugin 'com.huawei.agconnect'.
   > com.android.tools.build:gradle is no set in the build.gradle file

I've tried changing the Gradle Version and Kotlin version but all attempts have resulted in the same error.

Here is the Sample Flutter app to test and replicate the issue:
https://github.com/sswedan/Empty_Flutter

Expected behavior
I expect the project to build without errors

Current behavior

An exception occurred applying plugin request [id: 'com.huawei.agconnect']
> Failed to apply plugin 'com.huawei.agconnect'.
   > com.android.tools.build:gradle is no set in the build.gradle file

Screenshots

Logs
flutter build apk

[id: 'dev.flutter.flutter-plugin-loader', version: '1.0.0']
[id: 'com.android.application', version: '8.7.2', apply: false]
[id: 'org.jetbrains.kotlin.android', version: '1.7.10', apply: false]

com.huawei.agconnect.agcp
[id: 'com.huawei.agconnect.agcp', version: '1.9.1.300', artifact: 'com.huawei.agconnect:agcp:1.9.1.300', apply: false]
[id: 'com.android.application']
[id: 'kotlin-android']
[id: 'dev.flutter.flutter-gradle-plugin']
[id: 'com.huawei.agconnect']

FAILURE: Build failed with an exception.

  • Where:
    Build file 'empty_flutter\android\app\build.gradle' line: 7

  • What went wrong:
    An exception occurred applying plugin request [id: 'com.huawei.agconnect']

Failed to apply plugin 'com.huawei.agconnect'.
com.android.tools.build:gradle is no set in the build.gradle file

Environment

  • Platform: Flutter
  • Kit: Push
  • Kit Version 1.9.1.300
  • OS Version: Android 14
  • Android Studio version: 2022.2.1
  • Platform version: 3.24.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions