java.lang.NoClassDefFoundError: com/android/build/gradle/internal/ToolingRegistryProvider


#1

I have been trying to run an ionic v1 project that was made in Creator and downloaded as a ZIP archive. We have a proxy on the corporate network and this is currently causing issues with downloading dependencies from maven central/jcenter etc during the build. Whilst this is being looked at, I have installed the required dependencies using mvn install into my local maven repo from mvnrepository.com.

The following were downloaded and installed based on the following gradle build files:

  • platforms/android/build.grade

  • platforms/android/app/build.gradle

  • platforms/android/cordovaLib/build.gradle

      classpath 'com.android.tools.build:gradle:3.0.0'
      classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
      classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
    

I then changed the build.gradle files above so that the only entry in buildscript->respositories and allprojects->repositories is mavenLocal()

Running ionic cordova run android now gives me the following error:

ANDROID_HOME=C:\Users\XXXX\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_151
studio
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

*** Where:**
Build file ‘<project_path>\platforms\android\CordovaLib\build.gradle’ line: 37

*** What went wrong:**
A problem occurred evaluating project ‘:CordovaLib’.
> java.lang.NoClassDefFoundError: com/android/build/gradle/internal/ToolingRegistryProvider

Ionic info is:

cli packages: (C:\Users\XXXX\AppData\Roaming\npm\node_modules)

** @ionic/cli-utils : 1.19.2**
** ionic (Ionic CLI) : 3.20.0**

global packages:

** cordova (Cordova CLI) : 8.0.0**
** Gulp CLI : CLI version 3.9.1 Local version 3.9.1**

local packages:

** Cordova Platforms : android 7.0.0**
** Ionic Framework : ionic1 1.3.3**

System:

** Node : v8.2.1**
** npm : 5.3.0**
** OS : Windows 7**

Environment Variables:

** ANDROID_HOME : not set**

Misc:

** backend : pro**

I have Android Studio 3.0 installed with Android SDK 27
Also I have Gradle 4.3.1 installed on my machine