0

I'm trying to follow this YouTube tutorial for Android Studio, but when I create my project, I get the following error:

class org.jetbrains.kotlin.idea.core.script.configuration.CompositeScriptConfigurationManager cannot be cast to class org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager (org.jetbrains.kotlin.idea.core.script.configuration.CompositeScriptConfigurationManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @1824eb4b; org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @61548dd0)
class org.jetbrains.kotlin.idea.core.script.configuration.CompositeScriptConfigurationManager cannot be cast to class org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager (org.jetbrains.kotlin.idea.core.script.configuration.CompositeScriptConfigurationManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @1824eb4b; org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @61548dd0)

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.
  • AS: 2020.3.1 (renamed version from 4.3)
  • OS: Linux (Fedora)
  • Gradle: 6.8

At first, it seems very similar to this issue, but the first two lines of my error are different, likely because my AS version is much newer.

I am positive this has nothing to do with a network timeout.

I tried the solutions on the similar issue, deleting my Gradle wrapper from ~/.gradle/wrapper/dists and then re-syncing the project. While this removed the error, it failed to generate the app directory with the initial project files, and I was left with just the configuration files:

AS Project Window

Thus, I'm either looking for a different solution to the dependency cache error, or a fix for the missing project files.

This issue seems to be specific to projects in AS 2020.3.1 that use Kotlin. I could not reproduce with Java projects or AS 4.1.2 (the version used in the tutorial).

Update: Deleting and reinstalling AS 2020.3.1 did not solve the problem, but replacing AS 2020.3.1 with AS 4.1.2 did. Furthermore, after replacing 2020.3.1 with 4.1.2 and then reinstalling 2020.3.1, the project then worked on 2020.3.1. This must be due to a configuration issue with 2020.3.1 that is fixed via the configuration settings of a previous version.

Daniel C Jacobs
  • 691
  • 8
  • 18

1 Answers1

0

This is a hacky answer without much explanation, but after much hassle, the following solution resulted in a working project.

The problem appears to be caused by a configuration issue with 2020.3.1, and is solved by the automatic configuration that occurs upon opening a previous version of Android Studio.

  1. Delete Android Studio (my install_dir is /usr/local):
rm -rf {install_dir}/android_studio
  1. Download Android Studio 4.1.2 from the download archive
  2. Install and run Android Studio 4.1.2
tar -xvzf android-studio-ide-201.7042882-linux.tar.gz
cd android-studio/bin
./studio.sh

NOTE: If AS fails to run, remove disabled_plugins.txt

  1. Close Android Studio
  2. Redownload (if necessary) AS 2020.3.1
  3. Install and run AS 2020.3.1
tar -xvzf android-studio-2020.3.1.22-linux.tar.gz
cd android-studio/bin
./studio.sh

NOTE: Again here, if AS fails to run, remove disabled_plugins.txt

  1. Create an Empty Activity Kotlin project, and there should be no issues
Daniel C Jacobs
  • 691
  • 8
  • 18