在Android Studio虚拟设备中调试时出错

时间:2019-05-29 10:09:18

标签: android android-studio android-emulator avd

在Android仿真器中使用调试时,出现错误:

  

java.lang.RuntimeException:java.lang.RuntimeException:   java.io.FileNotFoundException:   D:\ Android \ androiddtudio_project \ vitrin-android \ app \ build \ intermediates \ instant_run_split_apk_resources \ debug \ instantRunSplitApkResourcesDebug \ out \ slice_6 \ resources_ap     在sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native   方法)   sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     在   sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     在java.lang.reflect.Constructor.newInstance(Constructor.java:423)     在   java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)     在   java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:677)     在java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:720)在   com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:149)     在   com.android.build.gradle.internal.transforms.InstantRunSliceSplitApkBuilder.transform(InstantRunSliceSplitApkBuilder.java:246)     在   com.android.build.gradle.internal.pipeline.TransformTask $ 2.call(TransformTask.java:239)     在   com.android.build.gradle.internal.pipeline.TransformTask $ 2.call(TransformTask.java:235)     在   com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)     在   com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)     在sun.reflect.GeneratedMethodAccessor85.invoke(未知源)在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:498)在   org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)在   org.gradle.api.internal.project.taskfactory.IncrementalTask​​Action.doExecute(IncrementalTask​​Action.java:47)     在   org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)     在   org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 2.run(ExecuteActionsTaskExecuter.java:284)     在   org.gradle.internal.operations.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)     在   org.gradle.internal.operations.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)     在   org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)     在   org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)     在   org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:273)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:258)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access $ 200(ExecuteActionsTaskExecuter.java:67)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ TaskExecution.execute(ExecuteActionsTaskExecuter.java:145)     在   org.gradle.internal.execution.impl.steps.ExecuteStep.execute(ExecuteStep.java:49)     在   org.gradle.internal.execution.impl.steps.CancelExecutionStep.execute(CancelExecutionStep.java:34)     在   org.gradle.internal.execution.impl.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:69)     在   org.gradle.internal.execution.impl.steps.TimeoutStep.execute(TimeoutStep.java:49)     在   org.gradle.internal.execution.impl.steps.CatchExceptionStep.execute(CatchExceptionStep.java:33)     在   org.gradle.internal.execution.impl.steps.CreateOutputsStep.execute(CreateOutputsStep.java:50)     在   org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:43)     在   org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:29)     在   org.gradle.internal.execution.impl.steps.CacheStep.executeWithoutCache(CacheStep.java:134)     在   org.gradle.internal.execution.impl.steps.CacheStep.lambda $ execute $ 3(CacheStep.java:83)     在java.util.Optional.orElseGet(Optional.java:267)在   org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:82)     在   org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:36)     在   org.gradle.internal.execution.impl.steps.PrepareCachingStep.execute(PrepareCachingStep.java:33)     在   org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:38)     在   org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:23)     在   org.gradle.internal.execution.impl.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)     在   org.gradle.internal.execution.impl.steps.SkipUpToDateStep.lambda $ execute $ 0(SkipUpToDateStep.java:89)     在java.util.Optional.map(Optional.java:215)在   org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:52)     在   org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:36)     在   org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:34)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:91)     在   org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:91)     在   org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)     在   org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:119)     在   org.gradle.api.internal.tasks.execution.ResolvePreviousStateExecuter.execute(ResolvePreviousStateExecuter.java:43)     在   org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:93)     在   org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:45)     在   org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:94)     在   org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:56)     在   org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:55)     在   org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)     在   org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter $ 1.executeTask(EventFiringTaskExecuter.java:67)     在   org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter $ 1.call(EventFiringTaskExecuter.java:52)     在   org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter $ 1.call(EventFiringTaskExecuter.java:49)     在   org.gradle.internal.operations.DefaultBuildOperationExecutor $ CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:315)     在   org.gradle.internal.operations.DefaultBuildOperationExecutor $ CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:305)     在   org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)     在   org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:101)     在   org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)     在   org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)     在   org.gradle.execution.plan.LocalTask​​NodeExecutor.execute(LocalTask​​NodeExecutor.java:43)     在   org.gradle.execution.taskgraph.DefaultTaskExecutionGraph $ InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)     在   org.gradle.execution.taskgraph.DefaultTaskExecutionGraph $ InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)     在   org.gradle.execution.taskgraph.DefaultTaskExecutionGraph $ BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)     在   org.gradle.execution.taskgraph.DefaultTaskExecutionGraph $ BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)     在   org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker $ 1.execute(DefaultPlanExecutor.java:134)     在   org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker $ 1.execute(DefaultPlanExecutor.java:129)     在   org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker.execute(DefaultPlanExecutor.java:202)     在   org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)     在   org.gradle.execution.plan.DefaultPlanExecutor $ ExecutorWorker.run(DefaultPlanExecutor.java:129)     在   org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)     在   org.gradle.internal.concurrent.ManagedExecutorImpl $ 1.run(ManagedExecutorImpl.java:46)     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     在   java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)     在   org.gradle.internal.concurrent.ThreadFactoryImpl $ ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)     在java.lang.Thread.run(Thread.java:745)造成原因:   java.lang.RuntimeException:java.io.FileNotFoundException:   D:\ Android \ androiddtudio_project \ vitrin-android \ app \ build \ intermediates \ instant_run_split_apk_resources \ debug \ instantRunSplitApkResourcesDebug \ out \ slice_6 \ resources_ap     在   java.util.concurrent.ForkJoinTask $ AdaptedCallable.exec(ForkJoinTask.java:1431)     在java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)     在   java.util.concurrent.ForkJoinPool $ WorkQueue.runTask(ForkJoinPool.java:1056)     在   java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)     在   java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)   引起原因:java.io.FileNotFoundException:   D:\ Android \ androiddtudio_project \ vitrin-android \ app \ build \ intermediates \ instant_run_split_apk_resources \ debug \ instantRunSplitApkResourcesDebug \ out \ slice_6 \ resources_ap     在   com.android.build.gradle.internal.transforms.InstantRunSliceSplitApkBuilder.lambda $ null $ 1(InstantRunSliceSplitApkBuilder.java:233)     在   java.util.concurrent.ForkJoinTask $ AdaptedCallable.exec(ForkJoinTask.java:1424)     ...还有4个

但是使用电话时没有问题。 我使用干净的项目并重建项目,但是没有用

error code

1 个答案:

答案 0 :(得分:1)

我曾经遇到此错误,可能是由变体问题引起的。其中之一是Instant Run

当我触发此错误时,我将尝试将其关闭:

  1. Double click Shift用于快速搜索,请键入instant run

  2. 选择Instant Run (preference),它将为您打开偏好设置

  3. 可能会勾选Enable Instant Run to hot swap...,请取消选中并尝试。

可能有效或可能无效,请告诉我是否有效。