2017-11-24 23 views
5

は私のプロジェクトがうまく動作していたが、突然、それはERRORを上げ開始します。エラー:タスク ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'の実行に失敗しました。 >

Gradle build finished with 1 error(s)

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $

それはAndroid EmulatorReal Deviceの両方で発生します。

私は再作成し、再同期プロジェクト

  • クローズとオープンAndroid Studio
  • Windowsを再起動します
  • 変更API(プロジェクト
  • のルートに.gradleフォルダを削除

    • に試してみました26,27)

    しかし成功しません。

    Android Studio 3.0.1

    EDIT 1:それはcom.google.code.gson:gson:2.8.2

    によって引き起こさだようだがここでスタックトレースをGradleのコンソール出力です:

    Executing tasks: [:app:assembleDebug] 
    
    Configuration on demand is an incubating feature. 
    :app:preBuild UP-TO-DATE 
    :app:preDebugBuild UP-TO-DATE 
    :app:compileDebugAidl UP-TO-DATE 
    :app:compileDebugRenderscript UP-TO-DATE 
    :app:checkDebugManifest UP-TO-DATE 
    :app:generateDebugBuildConfig UP-TO-DATE 
    :app:prepareLintJar UP-TO-DATE 
    :app:generateDebugResValues UP-TO-DATE 
    :app:generateDebugResources UP-TO-DATE 
    :app:mergeDebugResources UP-TO-DATE 
    :app:createDebugCompatibleScreenManifests UP-TO-DATE 
    :app:processDebugManifest 
    :app:splitsDiscoveryTaskDebug UP-TO-DATE 
    :app:processDebugResources 
    :app:generateDebugSources 
    :app:javaPreCompileDebug UP-TO-DATE 
    :app:compileDebugJavaWithJavac UP-TO-DATE 
    :app:compileDebugNdk NO-SOURCE 
    :app:compileDebugSources UP-TO-DATE 
    :app:mergeDebugShaders UP-TO-DATE 
    :app:compileDebugShaders UP-TO-DATE 
    :app:generateDebugAssets UP-TO-DATE 
    :app:mergeDebugAssets UP-TO-DATE 
    :app:transformClassesWithDexBuilderForDebug UP-TO-DATE 
    :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED 
    
    FAILURE: Build failed with an exception. 
    
    * What went wrong: 
    Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. 
    > java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $ 
    
    * Try: 
    Run with --info or --debug option to get more log output. 
    
    * Exception is: 
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. 
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100) 
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70) 
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63) 
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) 
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) 
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88) 
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52) 
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) 
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) 
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) 
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) 
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107) 
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241) 
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230) 
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124) 
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80) 
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105) 
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99) 
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625) 
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580) 
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99) 
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:60) 
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:128) 
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) 
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) 
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) 
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) 
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:46) 
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) 
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) 
        at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:311) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107) 
        at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:202) 
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:132) 
        at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:107) 
        at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:78) 
        at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:75) 
        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152) 
        at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100) 
        at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:75) 
        at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:53) 
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) 
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) 
        at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32) 
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107) 
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40) 
        at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51) 
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:45) 
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:29) 
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39) 
        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25) 
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:71) 
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:45) 
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:51) 
        at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32) 
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36) 
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25) 
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43) 
        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29) 
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:64) 
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:29) 
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55) 
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:42) 
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:58) 
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:33) 
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67) 
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37) 
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) 
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) 
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) 
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) 
        at org.gradle.util.Swapper.swap(Swapper.java:38) 
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) 
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55) 
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62) 
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82) 
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) 
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) 
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50) 
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297) 
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) 
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) 
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) 
    Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $ 
        at com.google.gson.Gson.fromJson(Gson.java:817) 
        at com.google.gson.Gson.fromJson(Gson.java:770) 
        at com.android.build.gradle.internal.pipeline.SubStream.loadSubStreams(SubStream.java:129) 
        at com.android.build.gradle.internal.pipeline.IntermediateFolderUtils.<init>(IntermediateFolderUtils.java:66) 
        at com.android.build.gradle.internal.pipeline.IntermediateStream.init(IntermediateStream.java:191) 
        at com.android.build.gradle.internal.pipeline.IntermediateStream.asOutput(IntermediateStream.java:135) 
        at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:229) 
        at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:218) 
        at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102) 
        at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:213) 
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) 
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173) 
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134) 
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121) 
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197) 
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107) 
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111) 
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92) 
        ... 102 more 
    Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $ 
        at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:351) 
        at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:79) 
        at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60) 
        at com.google.gson.Gson.fromJson(Gson.java:805) 
        ... 122 more 
    
    
    * Get more help at https://help.gradle.org 
    
    BUILD FAILED in 1s 
    
    19 actionable tasks: 3 executed, 16 up-to-date 
    
  • +1

    あなたの質問を編集し、Gradle Consoleの出力全体を投稿することをお勧めします.Gradle Consoleの出力だけではなく、そこにある何かが私たちにもっと手がかりを与えることを期待しています。 – CommonsWare

    +0

    このエラーの原因となっているGsonマッピングがどこかにあります。実際にListである属性にStringをマップしようとしているようです。この 'new Gson.fromJson(json、YourObject.class)'のように使用するリストを含むオブジェクトがいくつかありますか? –

    +0

    私はソースからGsonのすべての使用を削除し、gradleから 'implementation'も削除しましたが、何も変更されませんでした。 – mammadalius

    答えて

    1

    これが答えではありません。私はAndroid Studioをインストールしたばかりで、まったく同じ問題を抱えていると言います。新しいプロジェクトを開き、コードに触れずにHelloWorldサンプルアプリケーションを実行しようとすると、上記のエラーメッセージと全く同じ結果が得られ、Android Studioを再インストールしても問題は解決しませんでした。

    4

    回避方法:次の手順で同様の問題を解決しました: メニュー - >ビルド - >プロジェクトのクリーンアップ。 次に、プロジェクトをもう一度ビルドしてみてください。 お手伝いをしてください。

    +0

    完了前。失敗。 – mammadalius

    +2

    それは私のために働いた –

    +0

    これで成功しなかった、再構築し、(両方)複数回クリーニングしてみました。同様にすべての依存関係のバージョンを最新のものに更新しました。 – Harpreet

    2

    [ファイル] - > [キャッシュを無効にする/ を再起動し、[無効にして再起動]をクリックします。 スタジオの再起動後、「ビルド」 - >「プロジェクトのクリーンアップ」に移動します。

    1

    I次の手順で同様の問題を解決しました。 project次に、プロジェクトを再構築してみてください。それが役に立てば幸い。

    関連する問題