I can't figure out what I am missing , other projects are working fine but this project does not recognize R: and I also got this error:
Error:Execution failed for task 
':CpcBarcodeOpticonSample:processDebugResources'.
> com.android.ide.common.process.ProcessException: 
org.gradle.process.internal.ExecException: Process 'command 
'C:\Users\rhajou\AppData\Local\Android\Sdk\build-tools\22.0.1\aapt.exe''
 finished with non-zero exit value 1
Here is my code:
package fr.coppernic.samples.cpcbarcodeopticonsample;
import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.Menu;
public class MainActivity extends FragmentActivity {
    CollectionPagerAdapter mDemoCollectionPagerAdapter;
    ViewPager mViewPager;   
    public static ActionBar sActionBar = null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        sActionBar = getActionBar();
        setContentView(R.layout.activity_main);
        // ViewPager and its adapters use support library
        // fragments, so use getSupportFragmentManager.
        mDemoCollectionPagerAdapter = new CollectionPagerAdapter(getSupportFragmentManager());
        mViewPager = (ViewPager) findViewById(R.id.pager);
        mViewPager.setAdapter(mDemoCollectionPagerAdapter);
        mViewPager.setOnPageChangeListener(new OnPageChangeListener() {
            @Override
            public void onPageSelected(int arg0) {
                if (arg0 < 2) {
                    sActionBar.setSelectedNavigationItem(arg0);
                }
            }
            @Override
            public void onPageScrolled(int arg0, float arg1, int arg2) {
            }
            @Override
            public void onPageScrollStateChanged(int arg0) {
            }
        });               
        // Specify that tabs should be displayed in the action bar.
        sActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        // Create a tab listener that is called when the user changes tabs.
        ActionBar.TabListener tabListener = new ActionBar.TabListener() {
            @Override
            public void onTabReselected(Tab arg0, FragmentTransaction arg1) {
            }
            @Override
            public void onTabSelected(Tab arg0, FragmentTransaction arg1) {
                if (arg0.getPosition() < 2) {               
                        mViewPager.setCurrentItem(arg0.getPosition());
                    }
            }
            @Override
            public void onTabUnselected(Tab arg0, FragmentTransaction arg1) {
            }               
        };
        sActionBar.addTab(sActionBar.newTab().setText("Sample").setTabListener(tabListener));
        sActionBar.addTab(sActionBar.newTab().setText("About").setTabListener(tabListener));
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
}
The error is in the line before the last one: "Cannot resolve symbol R" I am missing something?
Note: I have the same error in MainFragment
Update: This is my build.gradle file:
apply plugin: 'com.android.application'
dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.android.support:support-v4:22.2.1'
}
android {
    compileSdkVersion 18
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDir 'libs'
        }
        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')
        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
    //buildTypes {
    //  release {
    //      minifyEnabled true
    //      proguardFile getDefaultProguardFile('proguard-android.txt')
    //  }
    //}
}
apply from: 'repo.gradle'
apply from: 'dependencies.gradle'
UPDATE
I tried to copy the project folder to the desktop (it was inside another folder on the desktop) and it's actually working!