簡體   English   中英

無法建立Android專案

[英]Unable to build android project

我只是接手了一個沒有任何文檔的android項目,所以我的(第一)工作是要構建應用。

我正在使用Android Studio 1.5.1

我的構建輸出如下所示:

AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027stextColorLink\u0027.","sources":[{"file":"D:\\android\\jobmatch\\app\\src\\main\\res\\values\\styles.xml","position":{"startLine":47,"startColumn":4,"startOffset":2338,"endLine":54,"endColumn":12,"endOffset":2702}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027stextSize\u0027.","sources":[{"file":"D:\\android\\jobmatch\\app\\src\\main\\res\\values\\styles.xml","position":{"startLine":47,"startColumn":4,"startOffset":2338,"endLine":54,"endColumn":12,"endOffset":2702}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027stextStyle\u0027.","sources":[{"file":"D:\\android\\jobmatch\\app\\src\\main\\res\\values\\styles.xml","position":{"startLine":47,"startColumn":4,"startOffset":2338,"endLine":54,"endColumn":12,"endOffset":2702}}],"original":"","tool":"AAPT"}
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
    Execution failed for task ':app:processDebugResources'.
    > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\tr\AppData\Local\Android\sdk\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1
 * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output

我沒有包括所有錯誤,因為它會持續不斷地發生與缺少attr資源有關的類似錯誤。

我的gradle文件如下所示:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'Google Inc.:Google APIs:23'
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.appchance.jobmatcher"
        minSdkVersion 14
        targetSdkVersion 21
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:21.0.3'
    compile files('libs/android-support-v7-recyclerview.jar')
    compile files('libs/crashlytics.jar')
    compile files('libs/httpmime-4.1.2.jar')
    compile files('libs/listviewanimations_lib-core-slh_3.1.0.jar')
    compile files('libs/listviewanimations_lib-core_3.1.0.jar')
    compile files('libs/listviewanimations_lib-manipulation_3.1.0.jar')
    compile files('libs/systembartint-1.0.4.jar')
    compile 'com.android.support:appcompat-v7:+'
}

Style.xml:

<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="AppTheme" parent="AppTheme.Base" />

    <style name="AppTheme.Translucent" parent="AppTheme.Base">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
    </style>

    <style name="AppTheme.Base" parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:colorForeground">@color/colorForeground</item>
        <item name="android:listChoiceIndicatorMultiple">@drawable/selector_check_box_empty</item>
        <item name="android:listChoiceIndicatorSingle">@drawable/selector_check_box_empty</item>
        <item name="actionMenuTextColor">@color/white</item>
        <item name="android:actionMenuTextColor">@color/white</item>
        <item name="sswitchStyle">@style/SwitchCustom</item>
    </style>

    <style name="ActionBarThemeOverlay" parent="">
        <item name="android:textColorPrimary">#fff</item>
        <item name="colorControlNormal">#fff</item>
        <item name="colorControlHighlight">#8fff</item>
        <item name="selectableItemBackground">@drawable/ab_item_background</item>
    </style>

    <style name="CustomSwitchTextAppearance" parent="TextAppearance.AppCompat.Widget.Switch">
        <item name="android:textColor">@color/white</item>
        <item name="android:textStyle">bold</item>
        <item name="android:textSize">11sp</item>
    </style>

    <style name="SwitchCustom">
        <item name="strack">@drawable/custom_switch_track</item>
        <item name="sthumb">@drawable/custom_switch_thumb</item>
        <item name="stextOn">@string/textOn</item>
        <item name="stextOff">@string/textOff</item>
        <item name="sthumbTextPadding">6dip</item>
        <item name="sswitchMinWidth">60dip</item>
        <item name="sswitchPadding">0dip</item>
        <item name="sswitchTextAppearance">@style/TextAppearanceSwitch</item>
    </style>

    <style name="TextAppearanceSwitch">
        <item name="stextColor">@color/white</item>
        <item name="stextColorHighlight">@color/white</item>
        <item name="stextColorHint">@color/white</item>
        <item name="stextColorLink">@color/white</item>
        <item name="stextSize">11sp</item>
        <item name="stextStyle">1</item>
    </style>

</resources>

我已經尋找了一種解決方案,但找不到解決方案,希望有人可以給我一些指示,因為我是android開發的新手。

1>清理項目並運行

如果不是

2>處理添加到build.gradle文件

dexOptions {
        javaMaxHeapSize "4g"
    }

只需將您的compileSdkVersion 'Google Inc.:Google APIs:23'更改為compileSdkVersion 23

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM