Hello,
I’m trying to create an android build for my application, but I keep getting this error.
A problem occurred evaluating project ':launcher'.
> Failed to apply plugin [id 'com.android.internal.version-check']
> Could not create plugin of type 'VersionCheckPlugin'.
> Could not initialize class com.android.build.gradle.internal.plugins.VersionCheckPlugin
General information:
- Unity 2021.3.24f1
- Gradle 6.1.1
- Gradle Plugin 4.0.1
- Java 1.8
- Min Build Target = API Level 22
Things I’ve tried:
- Reverting back to an older commit
- Completely uninstalling Unity, the Repo, and all related files and reinstalling
- Changing jCenter() in gradle.build to mavenCentral()
- Upgrading to Gradle 7.2 via Android Studio
I can’t seem to find anything on google regarding this library or class and it doesn’t seem like there are very many other people that have had this particular bug. I’m guessing that I’m probably using a deprecated library or something, but I haven’t found any information regarding that or what version I should be using. I was able to create a build a few days ago as well, but now this keeps happening.
I have been searching for many hours now so any help would be greatly appreciated.
Thanks
Relevant Files and Information (Probably. Please let me know if other files/information is needed):
Library\Bee\Android\Prj\Mono2x\Gradle\launcher\build.gradle
apply plugin: 'com.android.application'
dependencies {
implementation project(':unityLibrary')
}
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 22
targetSdkVersion 30
applicationId 'com.UnityTechnologies.com.unity.template.urpblank'
ndk {
abiFilters 'armeabi-v7a'
}
versionCode 1
versionName '0.1.0'
}
aaptOptions {
noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp'] + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}
lintOptions {
abortOnError false
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
signingConfig signingConfigs.debug
jniDebuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
signingConfig signingConfigs.debug
}
}
packagingOptions {
doNotStrip '*/armeabi-v7a/*.so'
}
bundle {
language {
enableSplit = false
}
density {
enableSplit = false
}
abi {
enableSplit = true
}
}
}```
**Library\Bee\Android\Prj\Mono2x\Gradle\build.gradle**
allprojects {
buildscript {
repositories {
google()
jcenter()
}
dependencies {
// If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
// See which Gradle version is preinstalled with Unity here Unity - Manual: Gradle for Android
// See official Gradle and Android Gradle Plugin compatibility table here Notes de version du plug-in Android Gradle 8.5 | Android Studio | Android Developers
// To specify a custom Gradle version in Unity, go do “Preferences > External Tools”, uncheck “Gradle Installed with Unity (recommended)” and specify a path to a custom Gradle version
classpath ‘com.android.tools.build:gradle:4.0.1’
}
}
repositories {
google()
jcenter()
flatDir {
dirs “${project(‘:unityLibrary’).projectDir}/libs”
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
**Library\Bee\Android\Prj\Mono2x\Gradle\unityLibrary\build.gradle**
apply plugin: ‘com.android.library’
dependencies {
implementation fileTree(dir: ‘libs’, include: ['.jar’])
}
android {
compileSdkVersion 30
buildToolsVersion ‘30.0.2’
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 22
targetSdkVersion 30
ndk {
abiFilters ‘armeabi-v7a’
}
versionCode 1
versionName ‘0.1.0’
consumerProguardFiles ‘proguard-unity.txt’
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = [‘.unity3d’, ‘.ress’, ‘.resource’, ‘.obb’, ‘.bundle’, ‘.unityexp’] + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!.scc:.:!CVS:!thumbs.db:!picasa.ini:!~"
}
packagingOptions {
doNotStrip ‘/armeabi-v7a/.so’
}
}
**gradle.properties**
org.gradle.jvmargs=-Xmx4096M
org.gradle.parallel=true
android.enableR8=false
unityStreamingAssets=
unityTemplateVersion=3
**gradle-wrapper**
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-bin.zip
**The Full Error Message**
CommandInvokationFailure: Gradle build failed.
C:\Program Files\Unity\Hub\Editor\2021.3.24f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath “C:\Program Files\Unity\Hub\Editor\2021.3.24f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-6.1.1.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx4096m” “assembleRelease”
stderr[
FAILURE: Build failed with an exception.*
Where:
Build file ‘C:\Users[redacted]\Documents\GitRepos[Project-Name]\Library\Bee\Android\Prj\Mono2x\Gradle\launcher\build.gradle’ line: 1
- What went wrong:
A problem occurred evaluating project ‘:launcher’.
Failed to apply plugin [id ‘com.android.internal.version-check’]
Could not create plugin of type ‘VersionCheckPlugin’.
Could not initialize class com.android.build.gradle.internal.plugins.VersionCheckPlugin
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 959ms
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
]
stdout[ ]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at <fa6b86c947e14a6a903c64a6b203942b>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action1[T] progress) (at :0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at :0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
Rethrow as BuildFailedException: Exception of type ‘UnityEditor.Build.BuildFailedException’ was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at :0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at :0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at :0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)