无法在任务上调用IncrementalTask​​.taskAction()':Udecide:processDebugResources'

时间:2013-12-17 07:16:29

标签: java android

在添加几个png后,我似乎无法运行我的应用程序。虽然我怀疑它与build.gradle有关。

我一般都是Android开发的新手,我似乎无法用Android Studio来解决这个问题。我注意到一些名为Gradle的内容,经过许多YouTube视频和谷歌搜索,我仍然不知道它是什么。我引用了这个链接here,但他对问题的解决方案与我的不一样。我已经运行'gradlew build --stacktrace',输出在下面。

我的src文件夹下还有一个红线,main,java,com.example.udecide,然后是MainActivity.java文件。在其粗体的地方我得到一个错误'无法解析方法setContentView(?)'和'无法解析符号'R''。我得到的第二个大胆部分'无法解决方法膨胀(....)'和'无法解决符号'R''。非常感谢我能得到的所有帮助。

这是我的MainActivity.java文件

package com.example.udecide;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.os.Build;
import android.widget.Button;

public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView**(R.layout.activity_main)**;

    Button searchList, filterList;
    searchList = (Button) findByViewId(R.id.btnList);
    searchList.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

        }
    });

    filterList = (Button) findByViewId(R.id.btnFilter);
    filterList.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

        }
    });
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(android.R.menu.main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    switch (item.getItemId()) {
        case android.R.id.action_settings:
            return true;
    }
    return super.onOptionsItemSelected(item);
}

/**
 * A placeholder fragment containing a simple view.
 */
public static class PlaceholderFragment extends Fragment {

    public PlaceholderFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate**(R.layout.fragment_main, container, false)**;
        return rootView;
    }
}

}

这是我运行'gradlew build --stacktrace'命令时得到的结果

C:\Users\Fernando\Desktop\Android Workspace\UdecideProject>gradlew build --stacktrace
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
:Udecide:preBuild UP-TO-DATE                                 
:Udecide:preDebugBuild UP-TO-DATE  
:Udecide:preReleaseBuild UP-TO-DATE  
:Udecide:prepareComAndroidSupportAppcompatV71900Library UP-TO-DATE  
:Udecide:prepareDebugDependencies             
:Udecide:compileDebugAidl UP-TO-DATE  
:Udecide:compileDebugRenderscript UP-TO-DATE  
:Udecide:generateDebugBuildConfig UP-TO-DATE  
:Udecide:mergeDebugAssets UP-TO-DATE  
:Udecide:mergeDebugResources UP-TO-DATE  
:Udecide:processDebugManifest UP-TO-DATE  
:Udecide:processDebugResources             
C:\Users\Fernando\Desktop\Android Workspace\UdecideProject\Udecide\build\res\all\debug\values\values.xml:532: error: Error retrieving parent for item: No resource found that matches the given name '@style/Theme.Holo.Light.DarkActionBar'.
C:\Users\Fernando\Desktop\Android Workspace\UdecideProject\Udecide\build\res\all\debug\values\values.xml:538: error: Error retrieving parent for item: No resource found that matches the given name '@style/Widget.Holo.Light.ActionBar.Solid.Inverse'.
:Udecide:processDebugResources FAILED      

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':Udecide:processDebugResources'.
> Could not call IncrementalTask.taskAction() on task ':Udecide:processDebugResources'

* Try:    
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':Udecide:processDebugResources'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:283)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$1.run(DefaultTaskPlanExecutor.java:33)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:214)
        at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:276)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:142)
        at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:78)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:31)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
        at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.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(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:46)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.Main.main(Main.java:37)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: org.gradle.api.GradleException: Could not call IncrementalTask.taskAction() on task ':Udecide:processDebugResources'
        at org.gradle.util.JavaMethod.invoke(JavaMethod.java:69)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:527)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:510)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
        ... 52 more
Caused by: com.android.ide.common.internal.LoggedErrorException: Failed to run command:
        C:\Program Files (x86)\Android\android-studio1\sdk\build-tools\android-4.4\aapt.exe package -f --no-crunch -I C:\Program Files (x86)\Android\android-studio1\sdk\platforms\android-19\android.jar -M C:\Users\Fernando\Desktop\Android Workspace\UdecideProje
ct\Udecide\build\manifests\debug\AndroidManifest.xml -S C:\Users\Fernando\Desktop\Android Workspace\UdecideProject\Udecide\build\res\all\debug -A C:\Users\Fernando\Desktop\Android Workspace\UdecideProject\Udecide\build\assets\debug -m -J C:\Users\Fernando\Deskt
op\Android Workspace\UdecideProject\Udecide\build\source\r\debug -F C:\Users\Fernando\Desktop\Android Workspace\UdecideProject\Udecide\build\libs\Udecide-debug.ap_ --debug-mode --custom-package com.example.udecide --output-text-symbols C:\Users\Fernando\Desktop
\Android Workspace\UdecideProject\Udecide\build\symbols\debug
Error Code:
        1
Output:
        C:\Users\Fernando\Desktop\Android Workspace\UdecideProject\Udecide\build\res\all\debug\values\values.xml:532: error: Error retrieving parent for item: No resource found that matches the given name '@style/Theme.Holo.Light.DarkActionBar'.
        C:\Users\Fernando\Desktop\Android Workspace\UdecideProject\Udecide\build\res\all\debug\values\values.xml:538: error: Error retrieving parent for item: No resource found that matches the given name '@style/Widget.Holo.Light.ActionBar.Solid.Inverse'.

        at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandLineRunner.java:98)
        at com.android.ide.common.internal.CommandLineRunner.runCmdLine(CommandLineRunner.java:69)
        at com.android.builder.AndroidBuilder.processResources(AndroidBuilder.java:617)
        at com.android.builder.AndroidBuilder$processResources.call(Unknown Source)
        at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.groovy:91)
        at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.groovy:71)
        at org.gradle.util.JavaMethod.invoke(JavaMethod.java:62)
        ... 59 more


BUILD FAILED

Total time: 4.323 secs
  [1]: https://stackoverflow.com/questions/20137212/could-not-call-incrementaltask-taskaction-on-task-myappprocessdebugresource

编辑1

styles.xml。从here

直截了当
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
           parent="@style/Theme.Holo.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
    </style>

    <!-- ActionBar styles -->
    <style name="MyActionBar"
           parent="@style/Widget.Holo.Light.ActionBar.Solid.Inverse">
        <item name="android:background">@drawable/actionbar_background</item>
    </style>
</resources>

引用的actionbar_background.xml在这里。它在drawable文件夹中。

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <solid
        android:color="@color/customColor" />
</shape>

它在这里引用customColor。它在res / values文件夹中的colors.xml中

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="customColor">#F05746</color>
</resources>

最后这是我改变主题的清单。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.udecide"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/CustomActionBarTheme" >
        <activity
            android:name="com.example.udecide.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

这就是我的其余代码。

1 个答案:

答案 0 :(得分:0)

您的某个xml文件中有一些无效的样式。

检查 res \ values \ values.xml 文件

您似乎正在尝试使用

@ style / Theme.Holo.Light.DarkActionBar style / Widget.Holo.Light.ActionBar.Solid.Inverse

很难说没有看到文件,但可能需要指定android:namespace。

android:Theme.Holo.Light.DarkActionBar