项目清理错误

Project Clean errors

我已经将我怀疑是在 Linux 机器上的 eclipse 中构建的项目导入到我在 Windows 机器上的 Android Studio 中。

许多关于文件类型、minsdkversion 等的问题被标记出来,我尝试解决,但最近这个问题可能是由我的尝试引起的,不确定。

我的 vXX\values.xml 文件中有超过 100 个错误,其中 XX 是 11、14 和 21,示例;

C:\Users\xxxx\Desktop\AutoSync\autoSync\build\intermediates\exploded-aar\com.android.support\appcompat-v7.0.0\res\values-v11\values.xml
Error:(47, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
C:\Users\xxxx\Desktop\AutoSync\autoSync\build\intermediates\exploded-aar\com.android.support\appcompat-v7.0.0\res\values-v14\values.xml
Error:(17, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
C:\Users\xxxxx\Desktop\AutoSync\autoSync\build\intermediates\exploded-aar\com.android.support\appcompat-v7.0.0\res\values-v21\values.xml
Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.

当我打开有问题的文件时,我看到如下错误:'cannot resolve symbol "android:actionModeShareDrawable"' 在下面的代码中:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Base.Theme.AppCompat" parent="Base.V11.Theme.AppCompat">
        <item name="android:actionModeShareDrawable">?actionModeShareDrawable</item>
    </style>

我在文件中看到评论说:

   <!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/lmp-mr1-dev/frameworks/support/v7/appcompat/res/values-v11/themes_base.xml -->

现在我从研究中怀疑我需要下载更多 API(我认为我只有 19、20 和 21)或者我需要以某种方式调整我的 build.Gradle 但我不确定解决方案。我的 build.Gradle 说了以下内容

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "21.1.2"
    defaultConfig {
        applicationId "com.xxxx.cvas.autosync"
        minSdkVersion 19
        targetSdkVersion 19
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile project(':gPITCommonautosync')
    compile project(':restApiAutoSync')
    compile 'com.android.support:support-v4:19.1.0'
    compile 'com.google.android.gms:play-services:+'
    compile files('libs/acra-4.5.0.jar')
    compile files('libs/android-saripaar-1.0.3 .jar')
    compile files('libs/zbar.jar')
}

知道这里会发生什么吗?

C:\Users\xxxx\Desktop\AutoSync\autoSync\build\intermediates\exploded-aar\com.android.support\appcompat-v7.0.0\res\values-v11\values.xml

看起来您正在使用最新版本的 AppCompat 库。从 v21 本身开始,它需要 API 级别 21 (Android 5.0) 才能成功编译。所以你的猜测是正确的,在你的 gradle 文件中将 compileSdkVersion 更改为 21