9

After upgrading to Android Studio 2.0 Preview I see the following exception when I try to build a project

Error:Internal error: (java.lang.ClassNotFoundException) com.android.repository.io.FileOpUtils
java.lang.ClassNotFoundException: com.android.repository.io.FileOpUtils
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at com.android.sdklib.repository.local.LocalSdk.<init>(LocalSdk.java:182)
at com.android.sdklib.repository.local.LocalSdk.<init>(LocalSdk.java:191)
at org.jetbrains.jps.android.AndroidBuildDataCache.getSdk(AndroidBuildDataCache.java:145)
at org.jetbrains.jps.android.AndroidJpsUtil.getAndroidTarget(AndroidJpsUtil.java:403)
at org.jetbrains.jps.android.AndroidJpsUtil.getAndroidPlatform(AndroidJpsUtil.java:478)
at org.jetbrains.jps.android.builder.AndroidPreDexBuildTarget.computeRootDescriptors(AndroidPreDexBuildTarget.java:110)
at org.jetbrains.jps.builders.impl.BuildRootIndexImpl.addRoots(BuildRootIndexImpl.java:72)
at org.jetbrains.jps.builders.impl.BuildRootIndexImpl.<init>(BuildRootIndexImpl.java:62)
at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:83)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:266)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:232)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:42)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

It is a known issue but any comments there are "me too".

Has anyone been able to workaround this?

Update

This issue has been resolved in 2.0 Preview 4.

Mark
  • 28,783
  • 8
  • 63
  • 92

1 Answers1

3

A workaround was posted in a comment to the issue filed.

On my Mac I performed the following steps in a Terminal:

  1. vi /Applications/Android\ Studio.app/Contents/plugins/android/lib/android.jar

  2. Select META-INF/plugin.xml for editing.

  3. Add ;repository.jar to the classpath attribute in the line <compileServer.plugin classpath="sdklib.jar;common.jar;jarutils.jar;layoutlib-api.jar;manifest-merger.jar"/> and save changes.

  4. Open Android Studio

As mentioned in the comment you may need to apply this workaround again after further updates to Android Studio if the issue still hasn't been resolved.

Warning

After applying the above changes Android Studio is no longer able to apply patch updates. You get a warning like that shown in this question. It seems the only solution is a re-install. According to the comments on the issue though the problem still exists in the latest build.

Community
  • 1
  • 1
Mark
  • 28,783
  • 8
  • 63
  • 92
  • Hi, 1 question. How do you select the file plugin.xml from the .jar for editing? I can see it in the .jar, but I can not manage to edit it. – Loebre Dec 16 '15 at 11:11
  • @Loebre vi presents the list of files within the jar. You can then select the file and edit/save directly into the jar file. – Mark Dec 16 '15 at 14:02