Android studio on windows 7 error :UNEXPECTED TOP-LEVEL EXCEPTION

Android studio on windows 7 error :UNEXPECTED TOP-LEVEL EXCEPTION

导入osmand项目时出现错误:

Error:Execution failed for task ':OsmAnd:preDexFreeLegacyArmv5Debug'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: E:\Android\sdk\build-tools.1.2\dx.bat --dex --force-jumbo --output E:\Android_test_projects\Osmand-master2\Osmand-master\OsmAnd\build\intermediates\pre-dexed\freelegacyarmv5\debug\OsmAnd-java-android-9c283cd307dbfef07359ccbde68a116b21ff0b4f.jar E:\Android_test_projects\Osmand-master2\Osmand-master\OsmAnd-java\build\libs\OsmAnd-java-android.jar Error Code: 1 Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000) at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472) at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406) at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388) at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251) at com.android.dx.command.dexer.Main.processClass(Main.java:704) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673) at com.android.dx.command.dexer.Main.access0(Main.java:83) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:602) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) at com.android.dx.command.dexer.Main.processOne(Main.java:632) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280) at com.android.dx.command.dexer.Main.run(Main.java:246) at com.android.dx.command.dexer.Main.main(Main.java:215) at com.android.dx.command.Main.main(Main.java:106) ...while parsing com/google/protobuf/AbstractMessage.class 1 error; aborting

上述错误的原因是 java 1.8。将其更改为 1.7 后,我得到了这个 运行 时间错误

      2-11 10:28:55.160  26327-26327/net.osmand V/Zygote﹕ Switching descriptor 34 to /dev/null
02-11 10:28:55.160  26327-26327/net.osmand V/Zygote﹕ Switching descriptor 9 to /dev/null
02-11 10:28:55.160  26327-26327/net.osmand D/dalvikvm﹕ Late-enabling CheckJNI
02-11 10:28:55.200  26327-26327/net.osmand D/ActivityThread﹕ handleBindApplication:net.osmand
02-11 10:28:55.200  26327-26327/net.osmand D/ActivityThread﹕ setTargetHeapUtilization:0.75
02-11 10:28:55.200  26327-26327/net.osmand D/ActivityThread﹕ setTargetHeapMinFree:2097152
02-11 10:28:55.260  26327-26327/net.osmand I/net.osmand﹕ ResourceManager Tiles to load in memory : 162.0
02-11 10:28:55.350  26327-26327/net.osmand D/AndroidRuntime﹕ Shutting down VM
02-11 10:28:55.350  26327-26327/net.osmand W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41653db8)
02-11 10:28:55.350  26327-26327/net.osmand E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: net.osmand, PID: 26327
    java.lang.RuntimeException: Unable to create application net.osmand.plus.OsmandApplication: java.lang.IllegalStateException: java.lang.IllegalArgumentException: is == null
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4476)
            at android.app.ActivityThread.access00(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5146)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalStateException: java.lang.IllegalArgumentException: is == null
            at net.osmand.router.RoutingConfiguration.getDefault(RoutingConfiguration.java:171)
            at net.osmand.plus.helpers.AvoidSpecificRoads.getBuilder(AvoidSpecificRoads.java:44)
            at net.osmand.plus.helpers.AvoidSpecificRoads.<init>(AvoidSpecificRoads.java:38)
            at net.osmand.plus.OsmandApplication.onCreate(OsmandApplication.java:165)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4473)
            at android.app.ActivityThread.access00(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5146)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalArgumentException: is == null
            at org.kxml2.io.KXmlParser.setInput(KXmlParser.java:1625)
            at net.osmand.router.RoutingConfiguration.parseFromInputStream(RoutingConfiguration.java:184)
            at net.osmand.router.RoutingConfiguration.getDefault(RoutingConfiguration.java:169)
            at net.osmand.plus.helpers.AvoidSpecificRoads.getBuilder(AvoidSpecificRoads.java:44)
            at net.osmand.plus.helpers.AvoidSpecificRoads.<init>(AvoidSpecificRoads.java:38)
            at net.osmand.plus.OsmandApplication.onCreate(OsmandApplication.java:165)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4473)
            at android.app.ActivityThread.access00(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5146)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
            at dalvik.system.NativeStart.main(Native Method)
        02-11 10:29:42.570  26327-26334/net.osmand D/dalvikvm﹕ null clazz in OP_INSTANCE_OF, single-stepping
        02-11 10:33:27.190  26327-26327/net.osmand I/Process﹕ Sending signal. PID: 26327 SIG: 9
        02-11 10:34:10.670  26873-26873/net.osmand D/ActivityThread﹕ handleBindApplication:net.osmand
        02-11 10:34:10.670  26873-26873/net.osmand D/ActivityThread﹕ setTargetHeapUtilization:0.75
        02-11 10:34:10.670  26873-26873/net.osmand D/ActivityThread﹕ setTargetHeapMinFree:2097152
        02-11 10:34:10.740  26873-26873/net.osmand I/net.osmand﹕ ResourceManager Tiles to load in memory : 162.0
        02-11 10:34:10.840  26873-26873/net.osmand D/AndroidRuntime﹕ Shutting down VM
        02-11 10:34:10.840  26873-26873/net.osmand W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41653db8)
        02-11 10:34:10.840  26873-26873/net.osmand E/AndroidRuntime﹕ FATAL EXCEPTION: main
            Process: net.osmand, PID: 26873
    java.lang.RuntimeException: Unable to create application net.osmand.plus.OsmandApplication: java.lang.IllegalStateException: java.lang.IllegalArgumentException: is == null
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4476)
            at android.app.ActivityThread.access00(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5146)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalStateException: java.lang.IllegalArgumentException: is == null
            at net.osmand.router.RoutingConfiguration.getDefault(RoutingConfiguration.java:171)
            at net.osmand.plus.helpers.AvoidSpecificRoads.getBuilder(AvoidSpecificRoads.java:44)
            at net.osmand.plus.helpers.AvoidSpecificRoads.<init>(AvoidSpecificRoads.java:38)
            at net.osmand.plus.OsmandApplication.onCreate(OsmandApplication.java:165)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4473)
            at android.app.ActivityThread.access00(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5146)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalArgumentException: is == null
            at org.kxml2.io.KXmlParser.setInput(KXmlParser.java:1625)
            at net.osmand.router.RoutingConfiguration.parseFromInputStream(RoutingConfiguration.java:184)
            at net.osmand.router.RoutingConfiguration.getDefault(RoutingConfiguration.java:169)
            at net.osmand.plus.helpers.AvoidSpecificRoads.getBuilder(AvoidSpecificRoads.java:44)
            at net.osmand.plus.helpers.AvoidSpecificRoads.<init>(AvoidSpecificRoads.java:38)
            at net.osmand.plus.OsmandApplication.onCreate(OsmandApplication.java:165)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4473)
            at android.app.ActivityThread.access00(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5146)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
            at dalvik.system.NativeStart.main(Native Method)
02-11 10:34:58.010  26873-26880/net.osmand D/dalvikvm﹕ null clazz in OP_INSTANCE_OF, single-stepping

我遇到了同样的问题,我将所有 .java class 文件移动到根包,所有错误都消失了...