Android Studio 2.0 FileOpUtils Not found

升级到Android Studio 2.0 Preview后,编译一直出以下错误

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:745)


刚开始google好久都没有什么答案。这几天终于找到了解决办法,原文链接  https://code.google.com/p/android/issues/detail?id=195173

使用7zip或者其它解压工具打开android-studio\plugins\android\lib\android.jar,打开META-INF\plugin.xml,或者文件复制出来用文本编辑器(如Notepad++)打开,在796行添加repository.jar,添加后该行的内容如下:

<compileServer.plugin classpath="sdklib.jar;common.jar;jarutils.jar;layoutlib-api.jar;manifest-merger.jar;repository.jar"/>


然后重新打开Android Studio 2.0,编译就正常了

你可能感兴趣的:(android,Studio,FileOpUtils)