AndroidStudio2.3编译可以通过,2.2 preview报错

我是导入的Eclipse项目,2.3可以编译调试,但是layout不能预览,2.2编译报错,错误如下:

 Error:Internal error: (java.lang.ClassNotFoundException) com.android.prefs.AndroidLocation$AndroidLocationException
java.lang.ClassNotFoundException: com.android.prefs.AndroidLocation$AndroidLocationException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.android.sdklib.repository.AndroidSdkHandler.getRepoConfig(AndroidSdkHandler.java:529)
    at com.android.sdklib.repository.AndroidSdkHandler.getSdkManager(AndroidSdkHandler.java:255)
    at com.android.sdklib.repository.AndroidSdkHandler.getAndroidTargetManager(AndroidSdkHandler.java:294)
    at org.jetbrains.jps.android.AndroidJpsUtil.getAndroidTarget(AndroidJpsUtil.java:407)
    at org.jetbrains.jps.android.AndroidJpsUtil.getAndroidPlatform(AndroidJpsUtil.java:480)
    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:44)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

2个回答

找不到包吧,最好就是把项目重新在AS里面搭建,因为导入的项目经常会因为AS版本不一样而出现找不到包的报错现象

删掉之前的包,重新dependece最新的包

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问