hms-react-native-plugin
hms-react-native-plugin copied to clipboard
fails to build Android with React Native 0.72.0
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
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")
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.
Has anyone found a solution to this?
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")
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.
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:
-
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"
-
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/' }
}
}
- In android/gradle/wrapper/gradle-wrapper.properties I changed version from:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
todistributionUrl=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",
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:
- 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"
- 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/' } } }
- In android/gradle/wrapper/gradle-wrapper.properties I changed version from:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
todistributionUrl=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?
@bserrano27 jdk 11, recommended for rn 0.72.6 in docs
i have the same issue :(