Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails to build Android with React Native 0.72.0 #286

Open
dhanazam opened this issue Jul 13, 2023 · 9 comments
Open

fails to build Android with React Native 0.72.0 #286

dhanazam opened this issue Jul 13, 2023 · 9 comments

Comments

@dhanazam
Copy link

dhanazam commented Jul 13, 2023

Hi, I created a new vanilla project with react native 0.71.11 and added "@hmscore/react-native-hms-map"

Everything worked well.
However, after upgrading to React Native 0.72.0, the build fails on android and throw the following error

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':app'.

Failed to notify project evaluation listener.
Could not create task ':app:transformClassesWithAPMSPluginForDebug'.
> Cannot use @TaskAction annotation on method IncrementalTransformTask.transform() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.
com.android.tools.build:gradle is no set in the build.gradle file

I also followed the given example from react-native-hms-map repo, still having this issues.
I suppose this isn't library bug but rather an issue with the new build system in general ?

here my full source code https://github.com/dhanazam/huaweiRN

thanks

@Johan-dutoit
Copy link

Johan-dutoit commented Jul 20, 2023

Facing the same on this side, but that's using any of the HMS packages.

0.72.0 introduces the following change that triggers this (note the lack of version specified)

classpath("com.android.tools.build:gradle")

@ukasiu
Copy link

ukasiu commented Aug 22, 2023

Hi, this is affecting us too. I cannot see any reasonable workaround as the AGCP plugin doesn't seem to be open source. We are probably gonna stop providing new updates for AppGallery users.

@scaralfred
Copy link

Has anyone found a solution to this?

@thelazydude00
Copy link

I manage to build successfully with rn 0.72.5.

package.json
"@hmscore/react-native-hms-push": "^6.10.0-300",

In root/gradle, I use this version

classpath("com.android.tools.build:gradle:7.4.1")
classpath("com.huawei.agconnect:agcp:1.9.1.301")

@LukasMod
Copy link

LukasMod commented Oct 31, 2023

I tried with ads and location and its not working. It's critical for us to find solution for that or we will have to stop updating app inside huawei store.

We use this 2 packages, already updated to the newest version:

        "@hmscore/react-native-hms-ads": "^13.4.65-300",
        "@hmscore/react-native-hms-location": "^6.12.0-300",

Based on version changes it should work with rn72.

I've tried add version to classpath("com.android.tools.build:gradle:7.4.1") and 7.3.1

I've also tried with different agconnect versions but with no success:
classpath "com.huawei.agconnect:agcp:1.9.1.301"
(tried 1.9.0.300, 1.6.0.300, with 1.5.2.300 it go further with diff errors, but i guess its super old)

Before adding gradle version it's same error as in question:

A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.huawei.agconnect'.
   > com.android.tools.build:gradle is no set in the root build.gradle file

After eg. classpath("com.android.tools.build:gradle:7.4.1"):

A problem occurred configuring project ':app'.
> Could not create task ':app:transformClassesWithAPMSPluginForDebug'.
   > Cannot use @TaskAction annotation on method IncrementalTransformTask.transform() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.

@LukasMod
Copy link

LukasMod commented Nov 6, 2023

Finally after checking out this location integration example - which would nevertheless be nice to update based on the new app from create-app... I found mix that is building with success on our project:

  1. I've updated push plugin from: 6.9.0.300 to 6.11.0.300 iside android/app/build.gradle:
    implementation "com.huawei.hms:push:6.11.0.300"

  2. In android/build.gradle I set gradle version and used 1.9.1.301 for agconnect:

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        kotlinVersion = '1.6.21'
        minSdkVersion = 23
        compileSdkVersion = 33
        targetSdkVersion = 33
        excludeAppGlideModule = true  
        ndkVersion = "23.1.7779620"
    }
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://developer.huawei.com/repo/' }
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.4.1")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath 'com.google.gms:google-services:4.3.15'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        classpath "com.huawei.agconnect:agcp:1.9.1.301"
    }
}

allprojects {
    repositories {
        maven { url 'https://developer.huawei.com/repo/' }
    }
}
  1. In android/gradle/wrapper/gradle-wrapper.properties I changed version from:
    distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
    to
    distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip

package.json:
"@hmscore/react-native-hms-ads": "^13.4.65-300",
"@hmscore/react-native-hms-location": "^6.12.0-300",
"react-native": "0.72.6",

@bserrano27
Copy link

Finally after checking out this location integration example - which would nevertheless be nice to update based on the new app from create-app... I found mix that is building with success on our project:

  1. I've updated push plugin from: 6.9.0.300 to 6.11.0.300 iside android/app/build.gradle:
    implementation "com.huawei.hms:push:6.11.0.300"
  2. In android/build.gradle I set gradle version and used 1.9.1.301 for agconnect:
buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        kotlinVersion = '1.6.21'
        minSdkVersion = 23
        compileSdkVersion = 33
        targetSdkVersion = 33
        excludeAppGlideModule = true  
        ndkVersion = "23.1.7779620"
    }
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://developer.huawei.com/repo/' }
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.4.1")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath 'com.google.gms:google-services:4.3.15'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        classpath "com.huawei.agconnect:agcp:1.9.1.301"
    }
}

allprojects {
    repositories {
        maven { url 'https://developer.huawei.com/repo/' }
    }
}
  1. In android/gradle/wrapper/gradle-wrapper.properties I changed version from:
    distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
    to
    distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip

package.json: "@hmscore/react-native-hms-ads": "^13.4.65-300", "@hmscore/react-native-hms-location": "^6.12.0-300", "react-native": "0.72.6",

Thanks for your response. Could you please tell me, what JDK version are you using?

@LukasMod
Copy link

@bserrano27
jdk 11, recommended for rn 0.72.6 in docs

@gerdigitalfemsa
Copy link

i have the same issue :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants