HMS-Core / hms-AREngine-demo

Huawei AREngine kit sample code demonstrates how to use Huawei AR functions, including motion tracking, plane detection, face recognition and gesture recognition, etc.
Apache License 2.0
102 stars 46 forks source link

Please include gradle-wrapper.properties #3

Closed IanusInferus closed 4 years ago

IanusInferus commented 4 years ago

When gradle\wrapper\gradle-wrapper.properties and related files are not included in the repo, on first open, Android Studio will create one by itself, but with a wrong gradle version(gradle-6.1.1-all.zip on Android 4.0.1), causing:

Unable to find method 'org.gradle.api.file.ProjectLayout.directoryProperty(Lorg/gradle/api/provider/Provider;)Lorg/gradle/api/file/DirectoryProperty;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)

The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)

Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Gradle version must match Android Gradle Plugin version. For com.android.tools.build:gradle:3.3.2, gradle-4.10.1-all.zip is required.

https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#updating-gradle

Mike-mei commented 4 years ago

Yes, you are right. Gradle version should match Android Gradle Plugin version. On first open, we should set gradle version as you did.

remmel commented 4 years ago

For everyone cloning that project, with Android studio 4, I needed to :

  1. Change Android Gradle project version from 3.3.2 to 4.01 : https://stackoverflow.com/a/63206864 Error was Unable to find method 'org.gradle.api.file.ProjectLayout.directoryProperty(Lorg/gradle/api/provider/Provider;)Lorg/gradle/api/file/DirectoryProperty;'.
  2. Create gradle.properties in root project folder with : android.useAndroidX=true Error was This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.
AppDev1020 commented 2 years ago

FAILURE: Build failed with an exception.

yy1103935431 commented 2 years ago

This is the SDK version, which is too old. You are advised to update it. For example: For the project structure, set Android Gradle Plugin Version to 4.1.2 ,Gradle Version 6.5. sync project with gradle files