1

私はAndroidプロジェクトを持っています.gradleでビルドしようとすると、「mergeDebugResources」タスクに進むと失敗しました。

gradle ビルド ファイル:

    buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.android.support:support-v4:13.0.+'
    compile fileTree(dir: 'libs', include: '*.jar')
}

android {

    compileSdkVersion 17
    buildToolsVersion "17.0.0"


    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 17
    }

    dependencies {
        compile project(":android-uitableview")
        compile project(":DragSortListView")
        compile project(":NewQuickAction")
        compile project(":PullToRefresh")
        compile project(":SlidingMenu")
        compile project(":umeng")
        compile project(":ViewPageIndicator")
    }

     sourceSets {
      main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
      }
    }
}

誰かが同じ問題を抱えていますか??

ログは役に立たないようです..

    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':qianqu:
mergeDebugResources'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecuteActions(ExecuteActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExec
uter.execute(PostExecutionAnalysisTaskExecuter.java:35)
        at org.gradle.api.internal.changedetection.state.CacheLockReleasingTaskE
xecuter$1.run(CacheLockReleasingTaskExecuter.java:35)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(Def
aultCacheAccess.java:179)
        at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(Def
aultCacheAccess.java:232)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunning
Operation(DefaultPersistentDirectoryStore.java:142)
        at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStat
eCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:83)
        at org.gradle.api.internal.changedetection.state.CacheLockReleasingTaskE
xecuter.execute(CacheLockReleasingTaskExecuter.java:33)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.exec
ute(SkipUpToDateTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.ContextualisingTaskExecuter.e
xecute(ContextualisingTaskExecuter.java:34)
        at org.gradle.api.internal.changedetection.state.CacheLockAcquiringTaskE
xecuter$1.run(CacheLockAcquiringTaskExecuter.java:39)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAcc
ess.java:124)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAcc
ess.java:112)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(De
faultPersistentDirectoryStore.java:134)
        at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStat
eCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
        at org.gradle.api.internal.changedetection.state.CacheLockAcquiringTaskE
xecuter.execute(CacheLockAcquiringTaskExecuter.java:37)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execut
e(ValidatingTaskExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecu
ter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter
.execute(SkipTaskWithNoActionsExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execut
e(SkipOnlyIfTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter
.execute(ExecuteAtMostOnceTaskExecuter.java:42)
        at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailur
e(AbstractTask.java:282)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.executeTask(De
faultTaskPlanExecutor.java:48)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.processTask(De
faultTaskPlanExecutor.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(Defaul
tTaskPlanExecutor.java:27)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(Defau
ltTaskGraphExecuter.java:89)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTask
ExecutionAction.java:29)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute
r.java:61)
        at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExec
uter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecu
ter.java:67)
        at org.gradle.api.internal.changedetection.state.TaskCacheLockHandlingBu
ildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java:31)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAcc
ess.java:124)
        at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAcc
ess.java:112)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(De
faultPersistentDirectoryStore.java:134)
        at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStat
eCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:79)
        at org.gradle.api.internal.changedetection.state.TaskCacheLockHandlingBu
ildExecuter.execute(TaskCacheLockHandlingBuildExecuter.java:29)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute
r.java:61)
        at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExec
uter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecu
ter.java:67)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildEx
ecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute
r.java:61)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute
r.java:54)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(Default
GradleLauncher.java:166)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradle
Launcher.java:113)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLaun
cher.java:81)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildCon
troller.run(InProcessBuildActionExecuter.java:64)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.jav
a:33)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.jav
a:24)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce
ssBuildActionExecuter.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce
ssBuildActionExecuter.java:26)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
        at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions
.java:171)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.
execute(CommandLineActionFactory.java:201)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.
execute(CommandLineActionFactory.java:174)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(
CommandLineActionFactory.java:170)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(
CommandLineActionFactory.java:139)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep
ortingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep
ortingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:48)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.Main.main(Main.java:39)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBoots
trap.java:50)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.j
ava:32)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: com.android.ide.common.res2.MergeConsumer$ConsumerException: java.lan
g.StringIndexOutOfBoundsException: String index out of range: -1
        at com.android.ide.common.res2.MergedResourceWriter.postWriteAction(Merg
edResourceWriter.java:273)
        at com.android.ide.common.res2.MergeWriter.end(MergeWriter.java:47)
        at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWr
iter.java:92)
        at com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:249)

        at com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.j
ava:25)
        at com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeR
esources.groovy:83)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(In
crementalTask.groovy:96)
        at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMeth
od(BeanDynamicObject.java:216)
        at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObj
ect.java:122)
        at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(Composite
DynamicObject.java:147)
        at com.android.build.gradle.tasks.MergeResources_Decorated.invokeMethod(
Unknown Source)
        at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskF
actory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:217)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskF
actory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskF
actory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:199)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(Abstra
ctTask.java:526)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(Abstra
ctTask.java:509)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecuteAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex
ecuteActions(ExecuteActionsTaskExecuter.java:61)
        ... 67 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range:
 -1
        at com.android.ide.common.xml.XmlPrettyPrinter.printText(XmlPrettyPrinte
r.java:439)
        at com.android.ide.common.xml.XmlPrettyPrinter.visitBeforeChildren(XmlPr
ettyPrinter.java:314)
        at com.android.ide.common.xml.XmlPrettyPrinter.visitNode(XmlPrettyPrinte
r.java:274)
        at com.android.ide.common.xml.XmlPrettyPrinter.visitNode(XmlPrettyPrinte
r.java:284)
        at com.android.ide.common.xml.XmlPrettyPrinter.visitNode(XmlPrettyPrinte
r.java:284)
        at com.android.ide.common.xml.XmlPrettyPrinter.visitNode(XmlPrettyPrinte
r.java:284)
        at com.android.ide.common.xml.XmlPrettyPrinter.prettyPrint(XmlPrettyPrin
ter.java:260)
        at com.android.ide.common.xml.XmlPrettyPrinter.prettyPrint(XmlPrettyPrin
ter.java:196)
        at com.android.ide.common.xml.XmlPrettyPrinter.prettyPrint(XmlPrettyPrin
ter.java:226)
        at com.android.ide.common.res2.MergedResourceWriter.postWriteAction(Merg
edResourceWriter.java:269)
        ... 85 more
4

1 に答える 1

0

最新のgradleをダウンロードしてください。

次に、MyComputer -> Properties -> Advanced Setting -> Environment Variable に移動して、クラス パスを設定します。

システム変数タブで、新しい変数を作成し、名前を付けますGRADLE_HOME は大文字にする必要があります。次に、値の後に、gradle の場所のパスを設定します。私のはC:\Users\SJM\Desktop\gradle-1.6\bin です。

次に、変更を適用してコマンド プロンプトを開き、gradle を書き込んで動作を確認します。

次に、 gradlewファイルを含むプロジェクトへのパスを設定します。

ここに添付した画像を参照してください。

ここに画像の説明を入力

コマンドプロンプトでプロジェクトへのパスを設定した後、このgradle compileDebugを書きます

コマンドプロンプトの出力は、どこが間違っているのかエラーを示しています。

于 2013-07-24T06:53:56.427 に答える